shadow-maint / shadow

Upstream shadow tree
Other
306 stars 237 forks source link

contrib/, lib/, src/: Use streq() instead of its pattern #1128

Open alejandro-colomar opened 1 week ago

alejandro-colomar commented 1 week ago

Except for the added (and sorted) includes, and the removal of redundant parentheses, this patch can be approximated with the following semantic patch:

$ cat ~/tmp/spatch/streq.sp;
@@
expression a, b;
@@

- strcmp(a, b) == 0
+ streq(a, b)

@@
expression a, b;
@@

- 0 == strcmp(a, b)
+ streq(a, b)

@@
expression a, b;
@@

- !strcmp(a, b)
+ streq(a, b)

$ find contrib/ lib* src/ -type f \
| xargs spatch --sp-file ~/tmp/spatch/streq.sp --in-place;
$ git restore lib/string/strcmp/streq.h;

Revisions:

v2 - Use `!streq()` instead of its pattern. ``` $ git range-diff shadow/master gh/streq streq 1: 10fea159 = 1: 10fea159 contrib/, lib/, src/: Use streq() instead of its pattern -: -------- > 2: 985ac5e5 lib/, src/: Use !streq() instead of its pattern ```