]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/, src/: Use !streq() instead of its pattern
authorAlejandro Colomar <alx@kernel.org>
Fri, 6 Dec 2024 00:59:23 +0000 (01:59 +0100)
committerSerge Hallyn <serge@hallyn.com>
Tue, 10 Dec 2024 02:54:42 +0000 (20:54 -0600)
commitc39305569bb47dbe15be1bd6686a96f06bdde483
treed1708b2852c83da1f3e5a5b94f52e053dc0d6c85
parent7182d6402f39e1be4c13d241edfed40dbe6eebe4
lib/, src/: Use !streq() instead of its pattern

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

$ cat ~/tmp/spatch/strneq.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/strneq.sp;

Signed-off-by: Alejandro Colomar <alx@kernel.org>
24 files changed:
lib/chkname.c
lib/fields.c
lib/fputsx.c
lib/getdate.y
lib/gshadow.c
lib/limits.c
lib/myname.c
lib/nss.c
lib/obscure.c
lib/port.c
lib/strtoday.c
lib/ttytype.c
lib/utmp.c
src/chfn.c
src/gpasswd.c
src/login.c
src/login_nopam.c
src/newgrp.c
src/newusers.c
src/passwd.c
src/pwck.c
src/su.c
src/useradd.c
src/usermod.c