[git commit] ls: avoid forward declaration. No code changes

Denys Vlasenko vda.linux at googlemail.com
Fri May 13 15:28:46 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=66ca241dcae32d7932c58398d27945d43702fc4e
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/ls.c |   88 +++++++++++++++++++++++++++----------------------------
 1 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/coreutils/ls.c b/coreutils/ls.c
index 0914d75..46abb62 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -890,51 +890,6 @@ static off_t calculate_blocks(struct dnode **dn)
 #endif
 
 
-static struct dnode **list_dir(const char *, unsigned *);
-
-static void showdirs(struct dnode **dn, int first)
-{
-	unsigned nfiles;
-	struct dnode **subdnp;
-
-	for (; *dn; dn++) {
-		if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) {
-			if (!first)
-				bb_putchar('\n');
-			first = 0;
-			printf("%s:\n", (*dn)->fullname);
-		}
-		subdnp = list_dir((*dn)->fullname, &nfiles);
-#if ENABLE_DESKTOP
-		if ((all_fmt & STYLE_MASK) == STYLE_LONG)
-			printf("total %"OFF_FMT"u\n", calculate_blocks(subdnp));
-#endif
-		if (nfiles > 0) {
-			/* list all files at this level */
-			dnsort(subdnp, nfiles);
-			showfiles(subdnp, nfiles);
-			if (ENABLE_FEATURE_LS_RECURSIVE
-			 && (all_fmt & DISP_RECURSIVE)
-			) {
-				struct dnode **dnd;
-				unsigned dndirs;
-				/* recursive - list the sub-dirs */
-				dnd = splitdnarray(subdnp, SPLIT_SUBDIR);
-				dndirs = count_dirs(subdnp, SPLIT_SUBDIR);
-				if (dndirs > 0) {
-					dnsort(dnd, dndirs);
-					showdirs(dnd, 0);
-					/* free the array of dnode pointers to the dirs */
-					free(dnd);
-				}
-			}
-			/* free the dnodes and the fullname mem */
-			dfree(subdnp);
-		}
-	}
-}
-
-
 /* Returns NULL-terminated malloced vector of pointers (or NULL) */
 static struct dnode **list_dir(const char *path, unsigned *nfiles_p)
 {
@@ -996,6 +951,49 @@ static struct dnode **list_dir(const char *path, unsigned *nfiles_p)
 }
 
 
+static void showdirs(struct dnode **dn, int first)
+{
+	unsigned nfiles;
+	struct dnode **subdnp;
+
+	for (; *dn; dn++) {
+		if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) {
+			if (!first)
+				bb_putchar('\n');
+			first = 0;
+			printf("%s:\n", (*dn)->fullname);
+		}
+		subdnp = list_dir((*dn)->fullname, &nfiles);
+#if ENABLE_DESKTOP
+		if ((all_fmt & STYLE_MASK) == STYLE_LONG)
+			printf("total %"OFF_FMT"u\n", calculate_blocks(subdnp));
+#endif
+		if (nfiles > 0) {
+			/* list all files at this level */
+			dnsort(subdnp, nfiles);
+			showfiles(subdnp, nfiles);
+			if (ENABLE_FEATURE_LS_RECURSIVE
+			 && (all_fmt & DISP_RECURSIVE)
+			) {
+				struct dnode **dnd;
+				unsigned dndirs;
+				/* recursive - list the sub-dirs */
+				dnd = splitdnarray(subdnp, SPLIT_SUBDIR);
+				dndirs = count_dirs(subdnp, SPLIT_SUBDIR);
+				if (dndirs > 0) {
+					dnsort(dnd, dndirs);
+					showdirs(dnd, 0);
+					/* free the array of dnode pointers to the dirs */
+					free(dnd);
+				}
+			}
+			/* free the dnodes and the fullname mem */
+			dfree(subdnp);
+		}
+	}
+}
+
+
 int ls_main(int argc UNUSED_PARAM, char **argv)
 {
 	struct dnode **dnd;
-- 
1.7.3.4



More information about the busybox-cvs mailing list