[BusyBox-cvs] busybox/applets applets.c,1.16,1.17

Manuel Novoa III mjn3 at codepoet.org
Thu Nov 28 15:55:34 UTC 2002


Glenn,

On Thu, Nov 28, 2002 at 01:33:08AM -0700, Glenn McGrath wrote:
> Update of /var/cvs/busybox/applets
> In directory winder:/tmp/cvs-serv20930/applets
> 
> Modified Files:
> 	applets.c 
> Log Message:
> Save a few bytes in show_usage

Are you sure about that?  With both gcc 2.95.4 and gcc 3.2 I show
an increase in code size with your patch, because you're introducing
an additional call to fprintf and an extra jump (before 'else' to the
exit call).

Manuel

> Index: applets.c
> ===================================================================
> RCS file: /var/cvs/busybox/applets/applets.c,v
> retrieving revision 1.16
> retrieving revision 1.17
> diff -u -d -r1.16 -r1.17
> --- applets.c	16 Sep 2002 06:22:18 -0000	1.16
> +++ applets.c	28 Nov 2002 08:33:04 -0000	1.17
> @@ -80,7 +80,6 @@
>  
>  extern void show_usage(void)
>  {
> -	const char *format_string;
>  	const char *usage_string = usage_messages;
>  	int i;
>  
> @@ -89,11 +88,12 @@
>  			--i;
>  		}
>  	}
> -	format_string = "%s\n\nUsage: %s %s\n\n";
> -	if(*usage_string == '\b')
> -		format_string = "%s\n\nNo help available.\n\n";
> -	fprintf(stderr, format_string,
> -			full_version, applet_using->name, usage_string);
> +
> +	if(*usage_string == '\b') {
> +		fprintf(stderr, "%s\n\nNo help available.\n\n", full_version);
> +	} else {
> +		fprintf(stderr, "%s\n\nUsage: %s %s\n\n", full_version, applet_using->name, usage_string);
> +	}
>  	exit(EXIT_FAILURE);
>  }



More information about the busybox-cvs mailing list