Alejandro Colomar
c39305569b
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 >
2024-12-09 20:54:42 -06:00
Alejandro Colomar
5581e74188
contrib/, lib/, src/: Use streq() instead of its pattern
...
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;
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-12-01 22:23:19 -06:00
Alejandro Colomar
f45adadd28
lib/, src/: Use stpspn() instead of its pattern
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-10-13 20:40:02 -05:00
Alejandro Colomar
59e5eef38f
contrib, lib/, src/, tests/: Use stpcpy(3) instead of its pattern
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-03 10:03:12 -05:00
Alejandro Colomar
761eb07016
lib/getdate.y: NULL doesn't need a cast
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-01 21:40:11 -05:00
Alejandro Colomar
efd169e010
lib/, src/: Use int main(void) where appropriate
...
Remove /*ARGSUSED*/ comments. Instead, use appropriate declarators for
main(). ISO C allows using int main(void) if the parameters are going
to be unused.
Also, do some cosmetic changes in the uses of argc and argv, to show
where they are used.
And use *argv[], instead of **argv. Array notation is friendlier, IMO.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-03-14 16:16:15 -05:00
Alejandro Colomar
4d139ca466
lib/getdate.y: get_date(): Fix calculation
...
Instead of adding 1, we should add the value the we stored previously in
the variable.
Fixes: 45c6603cc8 ("[svn-upgrade] Integrating new upstream version, shadow (19990709)")
Closes: <https://github.com/shadow-maint/shadow/issues/939 >
Link: <https://github.com/shadow-maint/shadow/pull/942 >
Reported-by: Michael Vetter <jubalh@iodoru.org >
Reported-by: Gus Kenion <https://github.com/kenion >
Cc: Iker Pedrosa <ipedrosa@redhat.com >
Cc: Serge Hallyn <serge@hallyn.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-02-16 19:58:43 -06:00
Pablo Saavedra
5d5d212764
lib/, src/: Rename 'unused' macro as 'MAYBE_UNUSED'
...
Related-To: https://github.com/shadow-maint/shadow/issues/918
Suggested-by: Alejandro Colomar <alx@kernel.org >
Signed-off-by: Pablo Saavedra <psaavedra@igalia.com >
2024-01-30 16:19:56 +01:00
Alejandro Colomar
44b8f7b3ef
lib/attr.h, lib/, src/: Move attributes to new header file
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2023-12-03 09:56:13 -06:00
Alejandro Colomar
093fb605f9
lib: Merge libmisc into libshadow
...
The separation was unnecessary, and caused build problems. Let's go
wild and obliterate the library. The files are moved to libshadow.
Scripted change:
$ find libmisc/ -type f \
| grep '\.[chy]$' \
| xargs mv -t lib;
Plus updating the Makefile and other references. While at it, I've
sorted the sources lists.
Link: <https://github.com/shadow-maint/shadow/pull/792 >
Reported-by: David Seifert <soap@gentoo.org >
Cc: Sam James <sam@gentoo.org >
Cc: Christian Bricart <christian@bricart.de >
Cc: Michael Vetter <jubalh@iodoru.org >
Cc: Robert Förster <Dessa@gmake.de >
[ soap tested the Gentoo package ]
Tested-by: David Seifert <soap@gentoo.org >
Acked-by: David Seifert <soap@gentoo.org >
Acked-by: Serge Hallyn <serge@hallyn.com >
Acked-by: Iker Pedrosa <ipedrosa@redhat.com >
Acked-by: <lslebodn@fedoraproject.org >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2023-08-31 08:55:26 +02:00