git » abk » commit c2d81ff

More memory usage reductions.

author Alberto Bertogli
2005-04-12 22:56:33 UTC
committer Alberto Bertogli
2005-04-12 22:56:33 UTC
parent 8d02c360126104a674e7bd4ae15c34e3a9fc3038

More memory usage reductions.

abk +7 -18

diff --git a/abk b/abk
index 56e928b..2dec45e 100644
--- a/abk
+++ b/abk
@@ -154,9 +154,9 @@ def finfo_copy_file(finfo, dst):
 	if finfo.type == 'r':
 		finfo.copy_file_reg(dst)
 	elif finfo.type == 'l':
-		finfo.copy_file_link(dst)
+		finfo_copy_file_link(dst)
 	elif finfo.type == 'b' or finfo.type == 'c':
-		finfo.copy_file_dev(dst)
+		finfo_copy_file_dev(dst)
 	elif finfo.type == 'f':
 		# we just create fifos
 		os.mkfifo(dst, finfo.mode & 07777)
@@ -220,18 +220,7 @@ class file_info:
 
 	# to save memory, reference external functions
 	load = finfo_load
-	cmp_mdata = finfo_cmp_mdata
-	cmp_data = finfo_cmp_data
-	copy_file_reg_raw = finfo_copy_file_reg_raw
-	copy_file_reg_bzip2 = finfo_copy_file_reg_bzip2
-	copy_file_reg_gzip = finfo_copy_file_reg_gzip
-	copy_file_link = finfo_copy_file_link
-	copy_file_dev = finfo_copy_file_dev
-	update_mdata = finfo_update_mdata
 	copy_file = finfo_copy_file
-	hash_file_sha = finfo_hash_file_sha
-	hash_file_md5 = finfo_hash_file_md5
-	hash_file_none = finfo_hash_file_none
 
 	# the following functions are modified by configuration
 	# hashing function
@@ -246,8 +235,8 @@ class file_info:
 	def __eq__(self, other):
 		"Compares to other file_info object."
 		if self.name != other.name: return 0
-		if not self.cmp_data(other): return 0
-		if not self.cmp_mdata(other): return 0
+		if not finfo_cmp_data(self, other): return 0
+		if not finfo_cmp_mdata(self, other): return 0
 
 		return 1
 
@@ -378,7 +367,7 @@ def make_sync(src_path, srcidx_path, dst_path, dstidx_path):
 	update_files = []
 	for f in srcidx.names:
 		if f not in dstidx.names or \
-				not srcidx.db[f].cmp_data(dstidx.db[f]):
+				not finfo_cmp_data(srcidx.db[f], dstidx.db[f]):
 			# files missing in destination, or data changed
 			#dst = os.path.join(dst_path, f)
 			dst = dst_path + '/' + f
@@ -386,7 +375,7 @@ def make_sync(src_path, srcidx_path, dst_path, dstidx_path):
 			quiet_unlink(dst)
 			srcidx.db[f].copy_file(dst)
 			update_files.append((f, dst))
-		elif not srcidx.db[f].cmp_mdata(dstidx.db[f]):
+		elif not finfo_cmp_mdata(srcidx.db[f], dstidx.db[f]):
 			# metadata changed
 			#dst = os.path.join(dst_path, f)
 			dst = dst_path + '/' + f
@@ -400,7 +389,7 @@ def make_sync(src_path, srcidx_path, dst_path, dstidx_path):
 	printv('* mdata')
 	for f, dst in update_files:
 		try:
-			srcidx.db[f].update_mdata(dst)
+			finfo_update_mdata(srcidx.db[f], dst)
 		except:
 			# it can fail if the destination doesn't have the
 			# file, ignore for now; TODO: output some kind of