svn commit: trunk/busybox/coreutils
Bernhard Fischer
rep.dot.nop at gmail.com
Thu Jan 18 00:15:54 PST 2007
On Thu, Jan 18, 2007 at 01:52:49AM +0100, Denis Vlasenko wrote:
>On Wednesday 17 January 2007 20:42, aldot at busybox.net wrote:
>> Author: aldot
>> Date: 2007-01-17 11:42:30 -0800 (Wed, 17 Jan 2007)
>> New Revision: 17348
>>
>> Log:
>> - reuse option_mask32 for state-handling in main
>> - improve check for errors from fcntl
>>
>>
>> Modified:
>> trunk/busybox/coreutils/stty.c
>>
>>
>> Changeset:
>> Modified: trunk/busybox/coreutils/stty.c
>> ===================================================================
>> --- trunk/busybox/coreutils/stty.c 2007-01-17 19:36:01 UTC (rev 17347)
>> +++ trunk/busybox/coreutils/stty.c 2007-01-17 19:42:30 UTC (rev 17348)
>> @@ -1014,24 +1014,19 @@
>> mode->c_cc[info->offset] = value;
>> }
>>
>> +#define STTY_require_set_attr (1<<0)
>> +#define STTY_speed_was_set (1<<1)
>> +#define STTY_verbose_output (1<<2)
>> +#define STTY_recoverable_output (1<<3)
>> +#define STTY_noargs (1<<4)
>> int stty_main(int argc, char **argv)
>> {
>> struct termios mode;
>> void (*output_func)(const struct termios *);
>> const char *file_name = NULL;
>> - int require_set_attr;
>> - int speed_was_set;
>> - int verbose_output;
>> - int recoverable_output;
>> - int noargs;
>> int k;
>> -
>> + option_mask32 = STTY_noargs;
>
>I disagree with this usage of option_mask32.
>
>Global variables should be generally avoided.
>I other words: if applet ALREADY stores getopt32
>result into global var, it's ok to delete that var
>and use option_mask32 instead (since it will do
>basically the same 'evil' thing, just with a tiny bit
>less code). However, if applet does NOT do it
>(does "local_opt = getopt32()" instead)
>do NOT convert it to use of global variable.
>
>I changed stty to use local variable.
Yeah, that added 29 (!) bytes for me (see other mail i just sent)
More information about the busybox
mailing list