svn commit: trunk/busybox/editors

vda at busybox.net vda at busybox.net
Mon Mar 24 18:40:32 UTC 2008


Author: vda
Date: 2008-03-24 11:40:32 -0700 (Mon, 24 Mar 2008)
New Revision: 21473

Log:
diff: improve comments (no code chages)



Modified:
   trunk/busybox/editors/diff.c


Changeset:
Modified: trunk/busybox/editors/diff.c
===================================================================
--- trunk/busybox/editors/diff.c	2008-03-24 18:18:03 UTC (rev 21472)
+++ trunk/busybox/editors/diff.c	2008-03-24 18:40:32 UTC (rev 21473)
@@ -282,6 +282,9 @@
 }
 
 
+/* Our diff implementation is using seek.
+ * When we meet non-seekable file, we must make a temp copy.
+ */
 static char *make_temp(FILE *f, struct stat *sb)
 {
 	char *name;
@@ -1160,7 +1163,7 @@
 #if ENABLE_FEATURE_DIFF_DIR
 /* This function adds a filename to dl, the directory listing. */
 static int add_to_dirlist(const char *filename,
-		struct stat ATTRIBUTE_UNUSED *sb,
+		struct stat *sb ATTRIBUTE_UNUSED,
 		void *userdata,
 		int depth ATTRIBUTE_UNUSED)
 {
@@ -1178,15 +1181,15 @@
 	dl_count = 0;
 	dl = xzalloc(sizeof(dl[0]));
 
-	/* If -r has been set, then the recursive_action function will be
-	 * used. Unfortunately, this outputs the root directory along with
-	 * the recursed paths, so use void *userdata to specify the string
-	 * length of the root directory - '(void*)(strlen(path)+)'.
-	 * add_to_dirlist then removes root dir prefix. */
+	/* We need to trim root directory prefix.
+	 * Using void *userdata to specify its length,
+	 * add_to_dirlist will remove it. */
 	if (option_mask32 & FLAG_r) {
 		recursive_action(path, ACTION_RECURSE|ACTION_FOLLOWLINKS,
-					add_to_dirlist, NULL,
-					(void*)(strlen(path)+1), 0);
+					add_to_dirlist, /* file_action */
+					NULL, /* dir_action */
+					(void*)(strlen(path) + 1),
+					0);
 	} else {
 		DIR *dp;
 		struct dirent *ep;
@@ -1328,12 +1331,12 @@
 		/* NB: "diff dir      dir2/dir3/file" must become
 		 *     "diff dir/file dir2/dir3/file" */
 		char *slash = strrchr(f2, '/');
-		f1 = concat_path_file(f1, slash ? slash+1 : f2);
+		f1 = concat_path_file(f1, slash ? slash + 1 : f2);
 		xstat(f1, &stb1);
 	}
 	if (S_ISDIR(stb2.st_mode)) {
 		char *slash = strrchr(f1, '/');
-		f2 = concat_path_file(f2, slash ? slash+1 : f1);
+		f2 = concat_path_file(f2, slash ? slash + 1 : f1);
 		xstat(f2, &stb2);
 	}
 




More information about the busybox-cvs mailing list