aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-06 02:36:23 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-06 02:36:23 +0200
commit90a9904e9ef5f2fb70e1952cb1a68bd9213bcde3 (patch)
tree46fabe3a471368b0bcee393123539775346d3410
parent1f7c167b23dfd5b03f386a657cb95867e1605e1b (diff)
downloadbusybox-w32-90a9904e9ef5f2fb70e1952cb1a68bd9213bcde3.tar.gz
busybox-w32-90a9904e9ef5f2fb70e1952cb1a68bd9213bcde3.tar.bz2
busybox-w32-90a9904e9ef5f2fb70e1952cb1a68bd9213bcde3.zip
remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)
function old new delta logdirs_reopen 1310 1308 -2 read_line_input 4757 4753 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/gzip.c2
-rw-r--r--editors/awk.c2
-rw-r--r--editors/sed.c2
-rw-r--r--include/libbb.h2
-rw-r--r--init/init.c2
-rw-r--r--libbb/lineedit.c3
-rw-r--r--libbb/loop.c2
-rw-r--r--mailutils/mime.c3
-rw-r--r--miscutils/less.c2
-rw-r--r--modutils/modprobe-small.c4
-rw-r--r--runit/svlogd.c2
-rw-r--r--selinux/setfiles.c2
-rw-r--r--shell/bbsh.c2
-rw-r--r--shell/hush.c5
-rw-r--r--util-linux/fbset.c4
15 files changed, 22 insertions, 17 deletions
diff --git a/archival/gzip.c b/archival/gzip.c
index 335846908..1e56c9dec 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -2078,7 +2078,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
2078 //if (opt & 0x4) // -v 2078 //if (opt & 0x4) // -v
2079 argv += optind; 2079 argv += optind;
2080 2080
2081 SET_PTR_TO_GLOBALS(xzalloc(sizeof(struct globals) + sizeof(struct globals2)) 2081 SET_PTR_TO_GLOBALS((char *)xzalloc(sizeof(struct globals)+sizeof(struct globals2))
2082 + sizeof(struct globals)); 2082 + sizeof(struct globals));
2083 barrier(); 2083 barrier();
2084 2084
diff --git a/editors/awk.c b/editors/awk.c
index cef73342c..30f09cbaf 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -486,7 +486,7 @@ struct globals2 {
486#define fsplitter (G.fsplitter ) 486#define fsplitter (G.fsplitter )
487#define rsplitter (G.rsplitter ) 487#define rsplitter (G.rsplitter )
488#define INIT_G() do { \ 488#define INIT_G() do { \
489 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G1) + sizeof(G)) + sizeof(G1)); \ 489 SET_PTR_TO_GLOBALS((char*)xzalloc(sizeof(G1)+sizeof(G)) + sizeof(G1)); \
490 G.next_token__ltclass = TC_OPTERM; \ 490 G.next_token__ltclass = TC_OPTERM; \
491 G.evaluate__seed = 1; \ 491 G.evaluate__seed = 1; \
492} while (0) 492} while (0)
diff --git a/editors/sed.c b/editors/sed.c
index 8b4f60a8c..b74941944 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1186,7 +1186,7 @@ static void process_files(void)
1186 case 'x': /* Exchange hold and pattern space */ 1186 case 'x': /* Exchange hold and pattern space */
1187 { 1187 {
1188 char *tmp = pattern_space; 1188 char *tmp = pattern_space;
1189 pattern_space = G.hold_space ? : xzalloc(1); 1189 pattern_space = G.hold_space ? G.hold_space : xzalloc(1);
1190 last_gets_char = '\n'; 1190 last_gets_char = '\n';
1191 G.hold_space = tmp; 1191 G.hold_space = tmp;
1192 break; 1192 break;
diff --git a/include/libbb.h b/include/libbb.h
index c795e6aad..9f7c26031 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1479,7 +1479,7 @@ extern struct globals *const ptr_to_globals;
1479/* At least gcc 3.4.6 on mipsel system needs optimization barrier */ 1479/* At least gcc 3.4.6 on mipsel system needs optimization barrier */
1480#define barrier() __asm__ __volatile__("":::"memory") 1480#define barrier() __asm__ __volatile__("":::"memory")
1481#define SET_PTR_TO_GLOBALS(x) do { \ 1481#define SET_PTR_TO_GLOBALS(x) do { \
1482 (*(struct globals**)&ptr_to_globals) = (x); \ 1482 (*(struct globals**)&ptr_to_globals) = (void*)(x); \
1483 barrier(); \ 1483 barrier(); \
1484} while (0) 1484} while (0)
1485 1485
diff --git a/init/init.c b/init/init.c
index 35f64cf8a..6bee8f35c 100644
--- a/init/init.c
+++ b/init/init.c
@@ -862,7 +862,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
862 struct sysinfo info; 862 struct sysinfo info;
863 863
864 if (sysinfo(&info) == 0 864 if (sysinfo(&info) == 0
865 && (info.mem_unit ? : 1) * (long long)info.totalram < 1024*1024 865 && (info.mem_unit ? info.mem_unit : 1) * (long long)info.totalram < 1024*1024
866 ) { 866 ) {
867 message(L_CONSOLE, "Low memory, forcing swapon"); 867 message(L_CONSOLE, "Low memory, forcing swapon");
868 /* swapon -a requires /proc typically */ 868 /* swapon -a requires /proc typically */
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 9a773b4b8..38c69c602 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2037,7 +2037,8 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2037 rewrite_line: 2037 rewrite_line:
2038 /* Rewrite the line with the selected history item */ 2038 /* Rewrite the line with the selected history item */
2039 /* change command */ 2039 /* change command */
2040 command_len = load_string(state->history[state->cur_history] ? : "", maxsize); 2040 command_len = load_string(state->history[state->cur_history] ?
2041 state->history[state->cur_history] : "", maxsize);
2041 /* redraw and go to eol (bol, in vi) */ 2042 /* redraw and go to eol (bol, in vi) */
2042 redraw(cmdedit_y, (state->flags & VI_MODE) ? 9999 : 0); 2043 redraw(cmdedit_y, (state->flags & VI_MODE) ? 9999 : 0);
2043 break; 2044 break;
diff --git a/libbb/loop.c b/libbb/loop.c
index 24dab1ac0..3fec7ad6d 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -105,7 +105,7 @@ int FAST_FUNC set_loop(char **device, const char *file, unsigned long long offse
105 } 105 }
106 106
107 /* Find a loop device. */ 107 /* Find a loop device. */
108 try = *device ? : dev; 108 try = *device ? *device : dev;
109 for (i = 0; rc; i++) { 109 for (i = 0; rc; i++) {
110 sprintf(dev, LOOP_FORMAT, i); 110 sprintf(dev, LOOP_FORMAT, i);
111 111
diff --git a/mailutils/mime.c b/mailutils/mime.c
index b856c8149..dd81139f2 100644
--- a/mailutils/mime.c
+++ b/mailutils/mime.c
@@ -177,7 +177,8 @@ int makemime_main(int argc UNUSED_PARAM, char **argv)
177static const char *find_token(const char *const string_array[], const char *key, const char *defvalue) 177static const char *find_token(const char *const string_array[], const char *key, const char *defvalue)
178{ 178{
179 const char *r = NULL; 179 const char *r = NULL;
180 for (int i = 0; string_array[i] != 0; i++) { 180 int i;
181 for (i = 0; string_array[i] != NULL; i++) {
181 if (strcasecmp(string_array[i], key) == 0) { 182 if (strcasecmp(string_array[i], key) == 0) {
182 r = (char *)string_array[i+1]; 183 r = (char *)string_array[i+1];
183 break; 184 break;
diff --git a/miscutils/less.c b/miscutils/less.c
index bd855066f..ce77ddd3a 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -624,7 +624,7 @@ static void print_found(const char *line)
624 624
625 while (match_status == 0) { 625 while (match_status == 0) {
626 char *new = xasprintf("%s%.*s"HIGHLIGHT"%.*s"NORMAL, 626 char *new = xasprintf("%s%.*s"HIGHLIGHT"%.*s"NORMAL,
627 growline ? : "", 627 growline ? growline : "",
628 match_structs.rm_so, str, 628 match_structs.rm_so, str,
629 match_structs.rm_eo - match_structs.rm_so, 629 match_structs.rm_eo - match_structs.rm_so,
630 str + match_structs.rm_so); 630 str + match_structs.rm_so);
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 0d78033c3..bbd700eb7 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -314,6 +314,7 @@ static int load_dep_bb(void)
314 314
315 while ((line = xmalloc_fgetline(fp)) != NULL) { 315 while ((line = xmalloc_fgetline(fp)) != NULL) {
316 char* space; 316 char* space;
317 char* linebuf;
317 int cur; 318 int cur;
318 319
319 if (!line[0]) { 320 if (!line[0]) {
@@ -328,7 +329,8 @@ static int load_dep_bb(void)
328 if (*space) 329 if (*space)
329 *space++ = '\0'; 330 *space++ = '\0';
330 modinfo[cur].aliases = space; 331 modinfo[cur].aliases = space;
331 modinfo[cur].deps = xmalloc_fgetline(fp) ? : xzalloc(1); 332 linebuf = xmalloc_fgetline(fp);
333 modinfo[cur].deps = linebuf ? linebuf : xzalloc(1);
332 if (modinfo[cur].deps[0]) { 334 if (modinfo[cur].deps[0]) {
333 /* deps are not "", so next line must be empty */ 335 /* deps are not "", so next line must be empty */
334 line = xmalloc_fgetline(fp); 336 line = xmalloc_fgetline(fp);
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 25c169aeb..66a13fbd0 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -670,7 +670,7 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
670 memRchr = memchr; 670 memRchr = memchr;
671 /* Add '\n'-terminated line to ld->inst */ 671 /* Add '\n'-terminated line to ld->inst */
672 while (1) { 672 while (1) {
673 int l = asprintf(&new, "%s%s\n", ld->inst ? : "", s); 673 int l = asprintf(&new, "%s%s\n", ld->inst ? ld->inst : "", s);
674 if (l >= 0 && new) 674 if (l >= 0 && new)
675 break; 675 break;
676 pause_nomem(); 676 pause_nomem();
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index b410d7ede..aabc37137 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
@@ -347,7 +347,7 @@ static int restore(const char *file)
347 * same. For "-vv", emit everything. */ 347 * same. For "-vv", emit everything. */
348 if (verbose > 1 || !user_only_changed) { 348 if (verbose > 1 || !user_only_changed) {
349 bb_info_msg("%s: reset %s context %s->%s", 349 bb_info_msg("%s: reset %s context %s->%s",
350 applet_name, my_file, context ?: "", newcon); 350 applet_name, my_file, context ? context : "", newcon);
351 } 351 }
352 } 352 }
353 353
diff --git a/shell/bbsh.c b/shell/bbsh.c
index 897c0227c..ad875abf5 100644
--- a/shell/bbsh.c
+++ b/shell/bbsh.c
@@ -212,7 +212,7 @@ int bbsh_main(int argc, char **argv)
212 unsigned cmdlen=0; 212 unsigned cmdlen=0;
213 for (;;) { 213 for (;;) {
214 if (!f) putchar('$'); 214 if (!f) putchar('$');
215 if (1 > getline(&command, &cmdlen,f ? : stdin)) break; 215 if (1 > getline(&command, &cmdlen, f ? f : stdin)) break;
216 216
217 handle(command); 217 handle(command);
218 } 218 }
diff --git a/shell/hush.c b/shell/hush.c
index 5794b1ddf..30eddadcc 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5794,7 +5794,7 @@ static struct pipe *parse_stream(char **pstring,
5794 * found. When recursing, quote state is passed in via dest->o_escape. 5794 * found. When recursing, quote state is passed in via dest->o_escape.
5795 */ 5795 */
5796 debug_printf_parse("parse_stream entered, end_trigger='%c'\n", 5796 debug_printf_parse("parse_stream entered, end_trigger='%c'\n",
5797 end_trigger ? : 'X'); 5797 end_trigger ? end_trigger : 'X');
5798 debug_enter(); 5798 debug_enter();
5799 5799
5800 G.ifs = get_local_var_value("IFS"); 5800 G.ifs = get_local_var_value("IFS");
@@ -6860,7 +6860,8 @@ static int FAST_FUNC builtin_cd(char **argv)
6860 * bash says "bash: cd: HOME not set" and does nothing 6860 * bash says "bash: cd: HOME not set" and does nothing
6861 * (exitcode 1) 6861 * (exitcode 1)
6862 */ 6862 */
6863 newdir = get_local_var_value("HOME") ? : "/"; 6863 const char *home = get_local_var_value("HOME");
6864 newdir = home ? home : "/";
6864 } 6865 }
6865 if (chdir(newdir)) { 6866 if (chdir(newdir)) {
6866 /* Mimic bash message exactly */ 6867 /* Mimic bash message exactly */
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index affeab061..358d0a8fc 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -254,7 +254,7 @@ static int read_mode_db(struct fb_var_screeninfo *base, const char *fn,
254} 254}
255#endif 255#endif
256 256
257static void setmode(struct fb_var_screeninfo *base, 257static void setfbmode(struct fb_var_screeninfo *base,
258 struct fb_var_screeninfo *set) 258 struct fb_var_screeninfo *set)
259{ 259{
260 if ((int32_t) set->xres > 0) 260 if ((int32_t) set->xres > 0)
@@ -402,7 +402,7 @@ int fbset_main(int argc, char **argv)
402 } 402 }
403 403
404 if (options & OPT_CHANGE) { 404 if (options & OPT_CHANGE) {
405 setmode(&var, &varset); 405 setfbmode(&var, &varset);
406 if (options & OPT_ALL) 406 if (options & OPT_ALL)
407 var.activate = FB_ACTIVATE_ALL; 407 var.activate = FB_ACTIVATE_ALL;
408 xioctl(fh, FBIOPUT_VSCREENINFO, &var); 408 xioctl(fh, FBIOPUT_VSCREENINFO, &var);