Commit e7d2860
tree-wide: convert open calls to remove spaces to skip_spaces() lib function
Makes use of skip_spaces() defined in lib/string.c for removing leading
spaces from strings all over the tree.
It decreases lib.a code size by 47 bytes and reuses the function tree-wide:
text data bss dec hex filename
64688 584 592 65864 10148 (TOTALS-BEFORE)
64641 584 592 65817 10119 (TOTALS-AFTER)
Also, while at it, if we see (*str && isspace(*str)), we can be sure to
remove the first condition (*str) as the second one (isspace(*str)) also
evaluates to 0 whenever *str == 0, making it redundant. In other words,
"a char equals zero is never a space".
Julia Lawall tried the semantic patch (http://coccinelle.lip6.fr) below,
and found occurrences of this pattern on 3 more files:
drivers/leds/led-class.c
drivers/leds/ledtrig-timer.c
drivers/video/output.c
@@
expression str;
@@
( // ignore skip_spaces cases
while (*str && isspace(*str)) { \(str++;\|++str;\) }
|
- *str &&
isspace(*str)
)
Signed-off-by: André Goddard Rosa <[email protected]>
Cc: Julia Lawall <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Jeff Dike <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Henrique de Moraes Holschuh <[email protected]>
Cc: David Howells <[email protected]>
Cc: <[email protected]>
Cc: Samuel Ortiz <[email protected]>
Cc: Patrick McHardy <[email protected]>
Cc: Takashi Iwai <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>1 parent 84c95c9 commit e7d2860
File tree
24 files changed
+66
-115
lines changed- arch
- s390/kernel
- um/drivers
- x86/kernel/cpu/mtrr
- drivers
- leds
- md
- parisc
- platform/x86
- pnp
- s390/block
- video
- backlight
- display
- fs
- cachefiles
- ext4
- kernel
- lib
- net
- irda/irnet
- netfilter
- sound/pci/hda
24 files changed
+66
-115
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
1178 | 1179 | | |
1179 | 1180 | | |
1180 | 1181 | | |
1181 | | - | |
| 1182 | + | |
1182 | 1183 | | |
1183 | 1184 | | |
1184 | 1185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
134 | | - | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
215 | | - | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | | - | |
564 | | - | |
| 563 | + | |
565 | 564 | | |
566 | 565 | | |
567 | 566 | | |
| |||
588 | 587 | | |
589 | 588 | | |
590 | 589 | | |
591 | | - | |
| 590 | + | |
592 | 591 | | |
593 | 592 | | |
594 | 593 | | |
| |||
712 | 711 | | |
713 | 712 | | |
714 | 713 | | |
715 | | - | |
| 714 | + | |
716 | 715 | | |
717 | 716 | | |
718 | 717 | | |
| |||
757 | 756 | | |
758 | 757 | | |
759 | 758 | | |
760 | | - | |
761 | | - | |
| 759 | + | |
762 | 760 | | |
763 | 761 | | |
764 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
136 | | - | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
| 145 | + | |
147 | 146 | | |
148 | 147 | | |
149 | 148 | | |
150 | | - | |
151 | | - | |
152 | | - | |
| 149 | + | |
153 | 150 | | |
154 | 151 | | |
155 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
600 | 601 | | |
601 | 602 | | |
602 | 603 | | |
603 | | - | |
604 | | - | |
605 | 604 | | |
606 | | - | |
607 | | - | |
| 605 | + | |
608 | 606 | | |
609 | 607 | | |
610 | 608 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
3439 | 3440 | | |
3440 | 3441 | | |
3441 | 3442 | | |
3442 | | - | |
3443 | | - | |
| 3443 | + | |
3444 | 3444 | | |
3445 | 3445 | | |
3446 | 3446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
788 | 785 | | |
789 | 786 | | |
790 | 787 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1006 | 1006 | | |
1007 | 1007 | | |
1008 | 1008 | | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
| 1009 | + | |
| 1010 | + | |
1014 | 1011 | | |
1015 | 1012 | | |
1016 | 1013 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
| 313 | + | |
315 | 314 | | |
316 | 315 | | |
317 | 316 | | |
| |||
353 | 352 | | |
354 | 353 | | |
355 | 354 | | |
356 | | - | |
357 | | - | |
| 355 | + | |
358 | 356 | | |
359 | | - | |
360 | | - | |
361 | | - | |
| 357 | + | |
362 | 358 | | |
363 | | - | |
364 | | - | |
| 359 | + | |
365 | 360 | | |
366 | | - | |
367 | | - | |
368 | | - | |
| 361 | + | |
369 | 362 | | |
370 | 363 | | |
371 | 364 | | |
372 | 365 | | |
373 | 366 | | |
374 | 367 | | |
375 | 368 | | |
376 | | - | |
377 | | - | |
378 | | - | |
| 369 | + | |
379 | 370 | | |
380 | | - | |
381 | | - | |
| 371 | + | |
382 | 372 | | |
383 | | - | |
384 | | - | |
385 | | - | |
| 373 | + | |
386 | 374 | | |
387 | 375 | | |
388 | 376 | | |
389 | 377 | | |
390 | 378 | | |
391 | 379 | | |
392 | 380 | | |
393 | | - | |
394 | | - | |
395 | | - | |
| 381 | + | |
396 | 382 | | |
397 | 383 | | |
398 | 384 | | |
399 | 385 | | |
400 | 386 | | |
401 | | - | |
402 | | - | |
403 | | - | |
| 387 | + | |
404 | 388 | | |
405 | 389 | | |
406 | 390 | | |
| |||
0 commit comments