]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/, src/: Use streq() instead of its pattern
authorAlejandro Colomar <alx@kernel.org>
Mon, 2 Dec 2024 12:16:56 +0000 (13:16 +0100)
committerSerge Hallyn <serge@hallyn.com>
Tue, 10 Dec 2024 02:54:42 +0000 (20:54 -0600)
commit7182d6402f39e1be4c13d241edfed40dbe6eebe4
tree97b1800c9877aafc7500f73759c7efcdd721f36d
parent8424d7c49462a6587c773f9b08c1867d7750f5ec
lib/, src/: Use streq() instead of its pattern

Except for the added (and sorted) includes, the removal of redundant
parentheses, a few cases that have been refactored for readability, and
a couple of non-string cases that I've left out of the change, this
patch can be approximated with the following semantic patch:

$ cat ~/tmp/spatch/streq.sp
@@
expression s;
@@

- '\0' == *s
+ streq(s, "")

@@
expression s;
@@

- '\0' == s[0]
+ streq(s, "")

@@
expression s;
@@

- *s == '\0'
+ streq(s, "")

@@
expression s;
@@

- s[0] == '\0'
+ streq(s, "")

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

Signed-off-by: Alejandro Colomar <alx@kernel.org>
28 files changed:
lib/getdef.c
lib/getrange.c
lib/limits.c
lib/list.c
lib/port.c
lib/prefix_flag.c
lib/pwauth.c
lib/salt.c
lib/setupenv.c
lib/sgetgrent.c
lib/sgetpwent.c
lib/sgetspent.c
lib/sssd.c
lib/strtoday.c
lib/subordinateio.c
lib/utmp.c
lib/valid.c
src/grpck.c
src/login.c
src/login_nopam.c
src/newgrp.c
src/passwd.c
src/su.c
src/suauth.c
src/sulogin.c
src/useradd.c
src/userdel.c
src/usermod.c