svn commit: trunk/busybox/coreutils

Bernhard Fischer rep.nop at aon.at
Thu Dec 14 03:39:19 PST 2006


On Thu, Dec 14, 2006 at 03:27:59AM -0800, aldot at busybox.net wrote:
>Author: aldot
>Date: 2006-12-14 03:27:58 -0800 (Thu, 14 Dec 2006)
>New Revision: 16919
>
>Log:
>- minor shrinkage

Note that from the looks, we have alot of places that would benefit from
being changed to last_char_is() respectively our other path-handling
functions (concat_path_file et al).

Also, there seem to be several users of the pattern
  if last character is 'c'
    nullify pos_of_c

To name just two:
the hunk below
du.c:125 ff

cheers,
>
>Modified:
>   trunk/busybox/coreutils/diff.c
>
>
>Changeset:
>Modified: trunk/busybox/coreutils/diff.c
>===================================================================
>--- trunk/busybox/coreutils/diff.c	2006-12-14 08:12:18 UTC (rev 16918)
>+++ trunk/busybox/coreutils/diff.c	2006-12-14 11:27:58 UTC (rev 16919)
>@@ -1105,10 +1105,12 @@
> 
> 	/* Check for trailing slashes. */
> 
>-	if (p1[strlen(p1) - 1] == '/')
>-		p1[strlen(p1) - 1] = '\0';
>-	if (p2[strlen(p2) - 1] == '/')
>-		p2[strlen(p2) - 1] = '\0';
>+	dp1 = last_char_is(p1, '/');
>+	if (dp1 != NULL)
>+		*dp1 = '\0';
>+	dp2 = last_char_is(p2, '/');
>+	if (dp2 != NULL)
>+		*dp2 = '\0';
> 
> 	/* Get directory listings for p1 and p2. */
> 
>
>_______________________________________________
>busybox-cvs mailing list
>busybox-cvs at busybox.net
>http://busybox.net/cgi-bin/mailman/listinfo/busybox-cvs
>


More information about the busybox mailing list