lib/, src/: Use !streq() instead of its pattern

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

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

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

	@@
	expression a, b;
	@@

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

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

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-11-24 18:40:48 +01:00
committed by Serge Hallyn
parent 5581e74188
commit 9f129146ff
16 changed files with 63 additions and 57 deletions

View File

@@ -496,7 +496,7 @@ static void new_pwent (struct passwd *pwent)
* used for this account.
*/
if ( (!is_shadow_pwd)
|| (strcmp (pwent->pw_passwd, SHADOW_PASSWD_STRING) != 0)) {
|| !streq(pwent->pw_passwd, SHADOW_PASSWD_STRING)) {
pwent->pw_passwd = new_pw_passwd (pwent->pw_passwd);
}
@@ -1164,7 +1164,7 @@ process_flags(int argc, char **argv)
}
if ( '\0' != optarg[0]
&& '*' != optarg[0]
&& strcmp(optarg, "/sbin/nologin") != 0
&& !streq(optarg, "/sbin/nologin")
&& ( stat(optarg, &st) != 0
|| S_ISDIR(st.st_mode)
|| access(optarg, X_OK) != 0)) {