Closed alejandro-colomar closed 1 month ago
I've also documented strndup(3) within string_copying(7) as a function that duplicates an input null-padded character sequence into an output newly allocated string:
commit 6af636f134d82b8d3838074fa6e0dce5efc356a4 (HEAD -> contrib, alx/contrib)
Author: Alejandro Colomar <alx@kernel.org>
Date: Tue May 14 19:36:53 2024 +0200
string_copying.7: Document strndup(3)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
diff --git a/man/man7/string_copying.7 b/man/man7/string_copying.7
index 281fff8be..0be53d1cf 100644
--- a/man/man7/string_copying.7
+++ b/man/man7/string_copying.7
@@ -61,6 +61,9 @@ .SS Null-padded character sequences
// Catenate a null-padded character sequence into a string.
.BI "char *strncat(char *restrict " dst ", const char " src "[restrict ." ssize ],
.BI " size_t " ssize );
+.P
+// Duplicate a null-padded character sequence into a string.
+.BI "char *strndup(const char " src [. ssize "], size_t " ssize );
.fi
.\" ----- SYNOPSIS :: Known-length character sequences --------------------/
.SS Known-length character sequences
@@ -154,6 +157,11 @@ .SS Terms (and abbreviations)
(or one after the last character in a character sequence)
after the call,
so that the programmer can use it to chain such calls.
+.\" ----- DESCRIPTION :: Terms (and abbreviations) :: duplicate -------/
+.TP
+.I duplicate
+Allocate a new buffer
+where a copy is placed.
.\" ----- DESCRIPTION :: Copy, catenate, and chain-copy ---------------/
.SS Copy, catenate, and chain-copy
Originally,
@@ -252,6 +260,8 @@ .SS Null-padded character sequences
and then you can treat it as a known-length character sequence;
or use
.BR strncat (3)
+or
+.BR strndup (3)
directly.
.\" ----- DESCRIPTION :: Known-length character sequences -----------------/
.SS Known-length character sequences
@@ -342,7 +352,11 @@ .SS String vs character sequence
has an even more misleading name than the functions above.
List of functions:
.IP \[bu] 3
+.PD 0
.BR strncat (3)
+.IP \[bu]
+.BR strndup (3)
+.PD
.P
Other functions operate on an input character sequence
to create an output character sequence.
@@ -453,6 +467,15 @@ .SS Functions
.IP
.I \%stpcpy(mempcpy(dst,\ src,\ strnlen(src,\ NITEMS(src))),\ \[dq]\[dq])
is a faster alternative to this function.
+.\" ----- DESCRIPTION :: Functions :: strndup(3) ----------------------/
+.TP
+.BR strndup (3)
+Duplicate the input character sequence,
+contained in a null-padded fixed-size buffer,
+into a newly allocated destination string.
+.IP
+The string must be freed with
+.BR free (3).
.\" ----- DESCRIPTION :: Functions :: mempcpy(3) ----------------------/
.TP
.BR mempcpy (3)
@@ -508,6 +531,9 @@ .SH RETURN VALUE
.I dst
pointer,
which is useless.
+.TP
+.BR strndup (3)
+The newly allocated string.
.\" ----- ERRORS ------------------------------------------------------/
.SH ERRORS
Most of these functions don't set
@@ -526,6 +552,13 @@ .SH ERRORS
.B E2BIG
The string has been truncated.
.RE
+.TP
+.BR strndup (3)
+.RS
+.TP
+.B ENOMEM
+Insufficient memory available to allocate duplicate string.
+.RE
.\" ----- NOTES :: strscpy(9) -----------------------------------------/
.SH NOTES
The Linux kernel has an internal function for copying strings,
@@ -689,6 +722,15 @@ .SH EXAMPLES
len = strlen(buf);
puts(buf);
.EE
+.\" ----- EXAMPLES :: strndup(3) --------------------------------------/
+.TP
+.BR strndup (3)
+.EX
+buf = strndup(u->ut_user, NITEMS(u->ut_user));
+len = strlen(buf);
+puts(buf);
+free(buf);
+.EE
.\" ----- EXAMPLES :: mempcpy(3) --------------------------------------/
.TP
.BR mempcpy (3)
@ikerexxe , if you want me to divide this into smaller PRs, let me know more or less the size you want to handle in each. ;)
@ikerexxe The codeq failure is spurious (see the resolved reports above). Feel free to review and merge when you find some time.
I'll queue this PR after https://github.com/shadow-maint/shadow/pull/1029, since they'll conflict, and that one is smaller than this one, so let's merge that first.
Thanks, I've looked through all of it, except for verifying that there are no accidental typos when moving functions into new files.
Thanks, I've looked through all of it, except for verifying that there are no accidental typos when moving functions into new files.
Thanks!
I checked lightly that with --color-moved
, which shows in a different color if you accidentally modify something. But I can never fully guarantee the absence of those. :)
This is ready, @hallyn
I was looking at some code about REALLOC(), due to my recent implementation of these macros in neomutt(1), just to do some sanity checks.
While doing that, I found that a few cases were still open-coding the REALLOCF() variant, so I changed that. Then I found nearby some other nasty open-coded versions of strcspn(3) and strsep(3), which I also adapted (in several steps). Then I found another case of REALLOCF().
And finally, while doing some of those simplifications, they made obvious that there was a forever loop in a mis-handled error from REALLOC().
Sorry for the churn, but it helped find a bug (edit: two bugs (edit: three bugs (edit: four or more bugs))), so I guess it's worth it. I hope I didn't do any mistakes in the simplifications... :-)
Revisions:
v2
- Found and fixed another bug, just a few lines above the other one; and this one was my fault. :) ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM -: -------- > 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation ```v3
- Add ZUSTR2STR(), and use it to implement XSTRNDUP() - Add XSTRNDUP() - Use XSTRNDUP() instead of its pattern - Use xasprintf() and xstrdup() instead of their patterns - Fix off-by-one bug in allocation size (**buffer overrun**) - And other minor churny changes. ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation -: -------- > 11: 6c58629d src/login.c: main(): Remove dead code -: -------- > 12: b76b8844 src/groupmems.c: Fix number of elements in allocation -: -------- > 13: ee2dc886 src/: Use xasprintf() instead of its pattern -: -------- > 14: 719c2c4d lib/Makefile.am: Add missing file -: -------- > 15: 39846f56 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro -: -------- > 16: 165d8e2a lib/string/strndup.[ch]: XSTRNDUP(): Add macro -: -------- > 17: 64a9dbc6 lib/utmp.c: Use XSTRNDUP() instead of its pattern -: -------- > 18: 511b5977 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern -: -------- > 19: 42a9c332 lib/utmp.c: prepare_utmp(): Reduce braces ```v3b
- Fix includes ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 6c58629d = 11: 6c58629d src/login.c: main(): Remove dead code 12: b76b8844 = 12: b76b8844 src/groupmems.c: Fix number of elements in allocation 13: ee2dc886 = 13: ee2dc886 src/: Use xasprintf() instead of its pattern 14: 719c2c4d = 14: 719c2c4d lib/Makefile.am: Add missing file 15: 39846f56 = 15: 39846f56 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 165d8e2a ! 16: 137dc501 lib/string/strndup.[ch]: XSTRNDUP(): Add macro @@ Commit message ## lib/Makefile.am ## @@ lib/Makefile.am: libshadow_la_SOURCES = \ + string/strftime.c \ + string/strftime.h \ string/strncpy.h \ ++ string/strndup.c \ ++ string/strndup.h \ string/strtcpy.c \ string/strtcpy.h \ -+ string/xstrndup.c \ -+ string/xstrndup.h \ string/zustr2stp.c \ - string/zustr2stp.h \ - strtoday.c \ ## lib/string/strndup.c (new) ## @@ @@ lib/string/strndup.c (new) + +#includev4
- Remove unused variable - Reduce scope of variables ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 6c58629d = 11: 6c58629d src/login.c: main(): Remove dead code 12: b76b8844 = 12: b76b8844 src/groupmems.c: Fix number of elements in allocation 13: ee2dc886 = 13: ee2dc886 src/: Use xasprintf() instead of its pattern 14: 719c2c4d = 14: 719c2c4d lib/Makefile.am: Add missing file 15: 39846f56 = 15: 39846f56 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 137dc501 = 16: 137dc501 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 17: c38cc491 = 17: c38cc491 lib/utmp.c: Use XSTRNDUP() instead of its pattern 18: 3410dd99 = 18: 3410dd99 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 19: 56fceba6 = 19: 56fceba6 lib/utmp.c: prepare_utmp(): Reduce braces 20: a7887298 = 20: a7887298 lib/, src/: Add missing include -: -------- > 21: a549fafb src/logoutd.c: main(): Remove unused variable -: -------- > 22: 3b786e56 src/logoutd.c: main(): Reduce scope of local variables ```v5
- Remove uses of ZUSTR2STP(), and replace them by XSTRNDUP() - Remove tests of ZUSTR2STP(), and replace them by tests of XSTRNDUP() ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 6c58629d = 11: 6c58629d src/login.c: main(): Remove dead code 12: b76b8844 = 12: b76b8844 src/groupmems.c: Fix number of elements in allocation 13: ee2dc886 = 13: ee2dc886 src/: Use xasprintf() instead of its pattern 14: 719c2c4d = 14: 719c2c4d lib/Makefile.am: Add missing file 15: 39846f56 = 15: 39846f56 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 137dc501 = 16: 137dc501 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 17: c38cc491 = 17: c38cc491 lib/utmp.c: Use XSTRNDUP() instead of its pattern 18: 3410dd99 = 18: 3410dd99 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 19: 56fceba6 = 19: 56fceba6 lib/utmp.c: prepare_utmp(): Reduce braces 20: a7887298 = 20: a7887298 lib/, src/: Add missing include 21: a549fafb = 21: a549fafb src/logoutd.c: main(): Remove unused variable 22: 3b786e56 = 22: 3b786e56 src/logoutd.c: main(): Reduce scope of local variables -: -------- > 23: df290b1c src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() -: -------- > 24: 08242fd0 lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation -: -------- > 25: e5447128 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() -: -------- > 26: be2f424b tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() ```v6
- Remove unnecessary casts - Fix calls to time(2) ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 6c58629d = 11: 6c58629d src/login.c: main(): Remove dead code 12: b76b8844 = 12: b76b8844 src/groupmems.c: Fix number of elements in allocation 13: ee2dc886 = 13: ee2dc886 src/: Use xasprintf() instead of its pattern 14: 719c2c4d = 14: 719c2c4d lib/Makefile.am: Add missing file 15: 39846f56 = 15: 39846f56 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 137dc501 = 16: 137dc501 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 17: c38cc491 = 17: c38cc491 lib/utmp.c: Use XSTRNDUP() instead of its pattern 18: 3410dd99 = 18: 3410dd99 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 19: 56fceba6 = 19: 56fceba6 lib/utmp.c: prepare_utmp(): Reduce braces 20: a7887298 = 20: a7887298 lib/, src/: Add missing include 21: a549fafb = 21: a549fafb src/logoutd.c: main(): Remove unused variable 22: 3b786e56 = 22: 3b786e56 src/logoutd.c: main(): Reduce scope of local variables 23: df290b1c = 23: df290b1c src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 24: 08242fd0 = 24: 08242fd0 lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 25: e5447128 = 25: e5447128 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: be2f424b = 26: be2f424b tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() -: -------- > 27: 8b595ff4 lib/getdate.y: NULL doesn't need a cast -: -------- > 28: 47a6170b lib/, src/: Always pass NULL to time(2) ```v6b
- Add fixes tag ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 6c58629d = 11: 6c58629d src/login.c: main(): Remove dead code 12: b76b8844 = 12: b76b8844 src/groupmems.c: Fix number of elements in allocation 13: ee2dc886 = 13: ee2dc886 src/: Use xasprintf() instead of its pattern 14: 719c2c4d = 14: 719c2c4d lib/Makefile.am: Add missing file 15: 39846f56 = 15: 39846f56 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 137dc501 = 16: 137dc501 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 17: c38cc491 = 17: c38cc491 lib/utmp.c: Use XSTRNDUP() instead of its pattern 18: 3410dd99 = 18: 3410dd99 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 19: 56fceba6 = 19: 56fceba6 lib/utmp.c: prepare_utmp(): Reduce braces 20: a7887298 = 20: a7887298 lib/, src/: Add missing include 21: a549fafb = 21: a549fafb src/logoutd.c: main(): Remove unused variable 22: 3b786e56 = 22: 3b786e56 src/logoutd.c: main(): Reduce scope of local variables 23: df290b1c = 23: df290b1c src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 24: 08242fd0 = 24: 08242fd0 lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 25: e5447128 = 25: e5447128 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: be2f424b = 26: be2f424b tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() 27: 8b595ff4 = 27: 8b595ff4 lib/getdate.y: NULL doesn't need a cast 28: 47a6170b ! 28: f07e5d38 lib/, src/: Always pass NULL to time(2) @@ Commit message The tloc argument is obsolescent and should always be NULL in new code. When tloc is NULL, the call cannot fail. + Fixes: 45c6603cc86c ("[svn-upgrade] Integrating new upstream version, shadow (19990709)") Signed-off-by: Alejandro Colomarv7
- Replace one strdup(3) by xstrdup(3) ``` $ git range-diff master gh/reduce reduce 1: 68483d8a = 1: 68483d8a lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 9fc5e5c7 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: 485e1546 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: 546ce642 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: 54785cb1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: fd4d9e4e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: 8ec8a50a lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 = 8: d6aba479 src/: Use strsep(3) instead of its pattern 9: 557d3455 = 9: 557d3455 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 964e70b9 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 6c58629d = 11: 6c58629d src/login.c: main(): Remove dead code 12: b76b8844 = 12: b76b8844 src/groupmems.c: Fix number of elements in allocation 13: ee2dc886 = 13: ee2dc886 src/: Use xasprintf() instead of its pattern 14: 719c2c4d = 14: 719c2c4d lib/Makefile.am: Add missing file 15: 39846f56 = 15: 39846f56 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 137dc501 = 16: 137dc501 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 17: c38cc491 = 17: c38cc491 lib/utmp.c: Use XSTRNDUP() instead of its pattern 18: 3410dd99 = 18: 3410dd99 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 19: 56fceba6 = 19: 56fceba6 lib/utmp.c: prepare_utmp(): Reduce braces 20: a7887298 = 20: a7887298 lib/, src/: Add missing include 21: a549fafb = 21: a549fafb src/logoutd.c: main(): Remove unused variable 22: 3b786e56 = 22: 3b786e56 src/logoutd.c: main(): Reduce scope of local variables 23: df290b1c = 23: df290b1c src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 24: 08242fd0 = 24: 08242fd0 lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 25: e5447128 = 25: e5447128 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: be2f424b = 26: be2f424b tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() 27: 8b595ff4 = 27: 8b595ff4 lib/getdate.y: NULL doesn't need a cast 28: f07e5d38 = 28: f07e5d38 lib/, src/: Always pass NULL to time(2) -: -------- > 29: 4faf560a src/newusers.c: main(): Exit on ENOMEM, by calling xstrdup() instead of strdup(3) ```v7b
- Rebase ``` $ git range-diff gh/master..gh/reduce shadow/master..reduce 1: 68483d8a = 1: 2f872500 lib/: Use REALLOCF() instead of its pattern 2: 9fc5e5c7 = 2: 22982691 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 485e1546 = 3: c2709bb4 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 546ce642 = 4: dfc4d9a6 lib/, src/: Use strchrnul(3) to remove conditionals 5: 54785cb1 = 5: d3c4b810 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: fd4d9e4e = 6: cb35cb7e src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: 8ec8a50a = 7: cd15d3dc lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: d6aba479 ! 8: e45dc97a src/: Use strsep(3) instead of its pattern @@ src/newusers.c: int main (int argc, char **argv) fprintf (stderr, _("%s: line %d: invalid line\n"), ## src/useradd.c ## -@@ src/useradd.c: static int set_defaults (void) +@@ src/useradd.c: err_free_new: */ static int get_groups (char *list) { 9: 557d3455 = 9: 5fb874b4 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 964e70b9 = 10: 39b898da lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 6c58629d = 11: 11368257 src/login.c: main(): Remove dead code 12: b76b8844 = 12: 33f82d7b src/groupmems.c: Fix number of elements in allocation 13: ee2dc886 = 13: 0c41cce0 src/: Use xasprintf() instead of its pattern 14: 719c2c4d = 14: 622c1090 lib/Makefile.am: Add missing file 15: 39846f56 = 15: 988466e5 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 137dc501 = 16: 4fb48700 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 17: c38cc491 = 17: 3e674707 lib/utmp.c: Use XSTRNDUP() instead of its pattern 18: 3410dd99 = 18: 586d1fba lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 19: 56fceba6 = 19: efa2cc09 lib/utmp.c: prepare_utmp(): Reduce braces 20: a7887298 = 20: 41891dec lib/, src/: Add missing include 21: a549fafb = 21: 81588919 src/logoutd.c: main(): Remove unused variable 22: 3b786e56 = 22: 16cd03b1 src/logoutd.c: main(): Reduce scope of local variables 23: df290b1c = 23: 112ad4c8 src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 24: 08242fd0 = 24: 49e1823f lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 25: e5447128 = 25: e504d79a tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: be2f424b = 26: e5a9b104 tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() 27: 8b595ff4 = 27: 3f1086cb lib/getdate.y: NULL doesn't need a cast 28: f07e5d38 = 28: 2a05b32c lib/, src/: Always pass NULL to time(2) 29: 4faf560a = 29: 9a071756 src/newusers.c: main(): Exit on ENOMEM, by calling xstrdup() instead of strdup(3) ```v7c
- Rebase ``` $ git range-diff master..gh/reduce shadow/master..reduce 1: 2f872500 = 1: 97f0ab70 lib/: Use REALLOCF() instead of its pattern 2: 22982691 = 2: 3d94f64a lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: c2709bb4 = 3: e18338a0 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: dfc4d9a6 = 4: cf1e02a4 lib/, src/: Use strchrnul(3) to remove conditionals 5: d3c4b810 = 5: 00023ee1 lib/, src/: Use strcspn(3) to simplify removal of '\n' 6: cb35cb7e = 6: 2bc9d12b src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 7: cd15d3dc = 7: 829d778c lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern 8: e45dc97a = 8: 38d02d93 src/: Use strsep(3) instead of its pattern 9: 5fb874b4 = 9: 92f7830c lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 10: 39b898da = 10: 5fc6945d lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 11: 11368257 = 11: f962a79b src/login.c: main(): Remove dead code 12: 33f82d7b = 12: acc6b9e8 src/groupmems.c: Fix number of elements in allocation 13: 0c41cce0 = 13: 6c46d747 src/: Use xasprintf() instead of its pattern 14: 622c1090 = 14: 1080768f lib/Makefile.am: Add missing file 15: 988466e5 = 15: 3d0fb0ec lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 16: 4fb48700 = 16: de6dee6a lib/string/strndup.[ch]: XSTRNDUP(): Add macro 17: 3e674707 = 17: 9aa6b8d0 lib/utmp.c: Use XSTRNDUP() instead of its pattern 18: 586d1fba = 18: 2fc1d558 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 19: efa2cc09 = 19: 4f1a6ecb lib/utmp.c: prepare_utmp(): Reduce braces 20: 41891dec = 20: 9492b749 lib/, src/: Add missing include 21: 81588919 = 21: bc621dc3 src/logoutd.c: main(): Remove unused variable 22: 16cd03b1 = 22: 51e6e60b src/logoutd.c: main(): Reduce scope of local variables 23: 112ad4c8 = 23: 3740360b src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 24: 49e1823f = 24: 4b674d8a lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 25: e504d79a = 25: 51b3663e tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: e5a9b104 = 26: 4be8c568 tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() 27: 3f1086cb = 27: b2487b84 lib/getdate.y: NULL doesn't need a cast 28: 2a05b32c = 28: 0b90d8d5 lib/, src/: Always pass NULL to time(2) 29: 9a071756 = 29: 0d38af22 src/newusers.c: main(): Exit on ENOMEM, by calling xstrdup() instead of strdup(3) ```v8
- strchrnul(3) results in simpler code than strcspn(3) ``` $ git range-diff --creation-factor=99 shadow/master gh/reduce reduce 1: 97f0ab70 = 1: 97f0ab70 lib/: Use REALLOCF() instead of its pattern 2: 3d94f64a = 2: 3d94f64a lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: e18338a0 = 3: e18338a0 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: cf1e02a4 < -: -------- lib/, src/: Use strchrnul(3) to remove conditionals 5: 00023ee1 ! 4: d955aaed lib/, src/: Use strcspn(3) to simplify removal of '\n' @@ Metadata Author: Alejandro Colomarv9
- Use strchrnul(3) in another place - Add missingv10
- Use strsep(3) in another place - Squash two commits - Clarify an assignment of an empty string ``` $ git range-diff shadow/master gh/reduce reduce 1: 97f0ab70 = 1: 97f0ab70 lib/: Use REALLOCF() instead of its pattern 2: 3d94f64a = 2: 3d94f64a lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: e18338a0 = 3: e18338a0 lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 0c31a685 = 4: 0c31a685 lib/, src/: Use strchrnul(3) instead of its pattern 5: 90b3abef = 5: 90b3abef src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 6: a517b951 < -: -------- lib/sgetspent.c: sgetspent(): Use strsep(3) instead of its pattern -: -------- > 6: 41227e4f lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 7: ba6fd2c0 ! 7: 2b592b8e src/: Use strsep(3) instead of its pattern @@ Metadata Author: Alejandro Colomarv11
- Remove dead code ``` $ git range-diff shadow/master gh/reduce reduce 1: 97f0ab70 ! 1: aa006a86 lib/: Use REALLOCF() instead of its pattern @@ lib/commonio.c: int commonio_open (struct commonio_db *db, int mode) (int) (buflen - len), ## lib/subordinateio.c ## +@@ lib/subordinateio.c: static bool all_digits(const char *str) + + static int append_uids(uid_t **uids, const char *owner, int n) + { +- uid_t owner_uid; +- uid_t *ret; +- int i; ++ int i; ++ uid_t owner_uid; + + if (all_digits(owner)) { + i = sscanf(owner, "%d", &owner_uid); @@ lib/subordinateio.c: static int append_uids(uid_t **uids, const char *owner, int n) return n; } 2: 3d94f64a = 2: a4a67952 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: e18338a0 = 3: 9f7e3f3f lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 0c31a685 = 4: 29fe6822 lib/, src/: Use strchrnul(3) instead of its pattern 5: 90b3abef = 5: 22ab9ccf src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 6: 41227e4f = 6: 59ba2329 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 7: 2b592b8e = 7: ea204ae3 lib/, src/: Use strsep(3) instead of its pattern 8: c1d531fc = 8: e9c5f0ab lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 9: d1ca750a = 9: 1bb39ddc lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 10: e94200ed = 10: f19ea03f src/login.c: main(): Remove dead code 11: 6f1be2f8 = 11: 71cafac4 src/groupmems.c: Fix number of elements in allocation 12: 1753a19f = 12: 187356c6 src/: Use xasprintf() instead of its pattern 13: 295a8819 = 13: 30457378 lib/Makefile.am: Add missing file 14: 285fb712 = 14: 3334781c lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 15: bcfcd4b3 = 15: 54bd1b7c lib/string/strndup.[ch]: XSTRNDUP(): Add macro 16: 36b4b1a3 = 16: ae742cf2 lib/utmp.c: Use XSTRNDUP() instead of its pattern 17: 07a8c91f = 17: aca896b8 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 18: 8c228cd8 = 18: 8faf4207 lib/utmp.c: prepare_utmp(): Reduce braces 19: 6f061c8e = 19: 81e53195 lib/, src/: Add missing include 20: af18b4d8 = 20: 264d4f3c src/logoutd.c: main(): Remove unused variable 21: e762b825 = 21: c7bf7001 src/logoutd.c: main(): Reduce scope of local variables 22: 19ab12f3 = 22: 0767270f src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 23: 8aa9ce50 = 23: e2ab6d4f lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 24: d7aad83b = 24: 1901ab33 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 25: 93e67309 = 25: becd83d7 tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() 26: 89866841 = 26: 9a75e0c7 lib/getdate.y: NULL doesn't need a cast -: -------- > 27: 26cd6e87 lib/failure.c: failprint(): Remove dead code 27: b1def328 ! 28: 5c6e6b1b lib/, src/: Always pass NULL to time(2) @@ lib/failure.c: static bool too_many_failures (const struct faillog *fl) if ((fl->fail_time + fl->fail_locktime) < now) { return false; /* enough time since last failure */ } -@@ lib/failure.c: void failprint (const struct faillog *fail) - } - - tp = localtime (&(fail->fail_time)); -- (void) time (&NOW); -+ NOW = time(NULL); - - /* - * Print all information we have. ## lib/log.c ## @@ lib/log.c: void dolastlog ( 28: ae0cc49d = 29: fef8a6c8 src/newusers.c: main(): Exit on ENOMEM, by calling xstrdup() instead of strdup(3) -: -------- > 30: 75341447 src/su.c: save_caller_context(): Remove unused parameter ```v12
- Add missing file to Makefile sources for a test ``` $ git range-diff shadow/master gh/reduce reduce 1: aa006a86 = 1: aa006a86 lib/: Use REALLOCF() instead of its pattern 2: a4a67952 = 2: a4a67952 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 9f7e3f3f = 3: 9f7e3f3f lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 29fe6822 = 4: 29fe6822 lib/, src/: Use strchrnul(3) instead of its pattern 5: 22ab9ccf = 5: 22ab9ccf src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 6: 59ba2329 = 6: 59ba2329 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 7: ea204ae3 = 7: ea204ae3 lib/, src/: Use strsep(3) instead of its pattern 8: e9c5f0ab = 8: e9c5f0ab lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 9: 1bb39ddc = 9: 1bb39ddc lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 10: f19ea03f = 10: f19ea03f src/login.c: main(): Remove dead code 11: 71cafac4 = 11: 71cafac4 src/groupmems.c: Fix number of elements in allocation 12: 187356c6 = 12: 187356c6 src/: Use xasprintf() instead of its pattern 13: 30457378 = 13: 30457378 lib/Makefile.am: Add missing file 14: 3334781c = 14: 3334781c lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 15: 54bd1b7c = 15: 54bd1b7c lib/string/strndup.[ch]: XSTRNDUP(): Add macro 16: ae742cf2 = 16: ae742cf2 lib/utmp.c: Use XSTRNDUP() instead of its pattern 17: aca896b8 = 17: aca896b8 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 18: 8faf4207 = 18: 8faf4207 lib/utmp.c: prepare_utmp(): Reduce braces 19: 81e53195 = 19: 81e53195 lib/, src/: Add missing include 20: 264d4f3c = 20: 264d4f3c src/logoutd.c: main(): Remove unused variable 21: c7bf7001 = 21: c7bf7001 src/logoutd.c: main(): Reduce scope of local variables 22: 0767270f = 22: 0767270f src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 23: e2ab6d4f = 23: e2ab6d4f lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 24: 1901ab33 = 24: 1901ab33 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 25: becd83d7 ! 25: 1b94784c tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() @@ tests/unit/Makefile.am: test_strncpy_LDADD = \ $(NULL) +test_strndup_SOURCES = \ ++ ../../lib/alloc.c \ + test_strndup.c \ + $(NULL) +test_strndup_CFLAGS = \ 26: 9a75e0c7 = 26: e187e2bd lib/getdate.y: NULL doesn't need a cast 27: 26cd6e87 = 27: bf2a2f7a lib/failure.c: failprint(): Remove dead code 28: 5c6e6b1b = 28: dceb2a80 lib/, src/: Always pass NULL to time(2) 29: fef8a6c8 = 29: 6111435c src/newusers.c: main(): Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 30: 75341447 = 30: df886067 src/su.c: save_caller_context(): Remove unused parameter ```v13
- Don't test XSTRNDUP(). Anything that depends on alloc functions pulls in so many dependencies to test. ``` $ git range-diff shadow/master gh/reduce reduce 1: aa006a86 = 1: aa006a86 lib/: Use REALLOCF() instead of its pattern 2: a4a67952 = 2: a4a67952 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 3: 9f7e3f3f = 3: 9f7e3f3f lib/commonio.c: commonio_open(): Reduce scope of local variables 4: 29fe6822 = 4: 29fe6822 lib/, src/: Use strchrnul(3) instead of its pattern 5: 22ab9ccf = 5: 22ab9ccf src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 6: 59ba2329 = 6: 59ba2329 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 7: ea204ae3 = 7: ea204ae3 lib/, src/: Use strsep(3) instead of its pattern 8: e9c5f0ab = 8: e9c5f0ab lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 9: 1bb39ddc = 9: 1bb39ddc lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 10: f19ea03f = 10: f19ea03f src/login.c: main(): Remove dead code 11: 71cafac4 = 11: 71cafac4 src/groupmems.c: Fix number of elements in allocation 12: 187356c6 = 12: 187356c6 src/: Use xasprintf() instead of its pattern 13: 30457378 = 13: 30457378 lib/Makefile.am: Add missing file 14: 3334781c = 14: 3334781c lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 15: 54bd1b7c = 15: 54bd1b7c lib/string/strndup.[ch]: XSTRNDUP(): Add macro 16: ae742cf2 = 16: ae742cf2 lib/utmp.c: Use XSTRNDUP() instead of its pattern 17: aca896b8 = 17: aca896b8 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 18: 8faf4207 = 18: 8faf4207 lib/utmp.c: prepare_utmp(): Reduce braces 19: 81e53195 = 19: 81e53195 lib/, src/: Add missing include 20: 264d4f3c = 20: 264d4f3c src/logoutd.c: main(): Remove unused variable 21: c7bf7001 = 21: c7bf7001 src/logoutd.c: main(): Reduce scope of local variables 22: 0767270f = 22: 0767270f src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 23: e2ab6d4f = 23: e2ab6d4f lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 24: 1901ab33 = 24: 1901ab33 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 25: 1b94784c < -: -------- tests/unit/: Repurpose ZUSTR2STR() tests for XSTRNDUP() 26: e187e2bd = 25: a73c45e8 lib/getdate.y: NULL doesn't need a cast 27: bf2a2f7a = 26: c99404fe lib/failure.c: failprint(): Remove dead code 28: dceb2a80 = 27: 6fe06842 lib/, src/: Always pass NULL to time(2) 29: 6111435c = 28: 1142d6bd src/newusers.c: main(): Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 30: df886067 = 29: 291b3e3a src/su.c: save_caller_context(): Remove unused parameter ```v13b
- Squash some commits - Reorder commits - Simplify some commit messages ``` $ git range-diff --creation-factor=99 shadow/master gh/reduce reduce 29: 291b3e3a = 1: dac868b2 src/su.c: save_caller_context(): Remove unused parameter 20: 264d4f3c ! 2: 84611483 src/logoutd.c: main(): Remove unused variable @@ Metadata Author: Alejandro Colomarv13c
- Fix includes ``` $ git range-diff shadow/master gh/reduce reduce 1: dac868b2 = 1: dac868b2 src/su.c: save_caller_context(): Remove unused parameter 2: 84611483 = 2: 84611483 src/logoutd.c: Remove unused variable 3: c659e125 = 3: c659e125 src/login.c: Remove dead code 4: 90d7f3bf = 4: 90d7f3bf lib/, src/: Reduce scope of local variables 5: 05a0c1bc = 5: 05a0c1bc lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 861e3c89 = 6: 861e3c89 lib/getdate.y: NULL doesn't need a cast 7: 8e10fdca = 7: 8e10fdca lib/, src/: Always pass NULL to time(2) 8: 83bb6e13 = 8: 83bb6e13 lib/failure.c: failprint(): Remove dead code 9: c50f671d = 9: c50f671d lib/Makefile.am: Add missing file 10: f290e305 = 10: f290e305 lib/, src/: Add missing include 11: f206979e = 11: f206979e lib/: Use REALLOCF() instead of its pattern 12: 7b7271c2 = 12: 7b7271c2 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: bbcbd7bd = 13: bbcbd7bd lib/, src/: Use strchrnul(3) instead of its pattern 14: 42b086b5 = 14: 42b086b5 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: 3f75d467 = 15: 3f75d467 lib/, src/: Use strsep(3) instead of its pattern 16: 80183769 = 16: 80183769 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: ea22f334 = 17: ea22f334 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: ad3fbd48 = 18: ad3fbd48 src/groupmems.c: Fix number of elements in allocation 19: 6dbab221 ! 19: 2bed0218 src/: Use xasprintf() instead of its pattern @@ Commit message ## lib/obscure.c ## @@ - #includev14
- Add STRNCAT() - Remove ZUSTR2STP() - Reimplement ZUSTR2STR() ``` $ git range-diff shadow/master gh/reduce reduce 1: dac868b2 = 1: dac868b2 src/su.c: save_caller_context(): Remove unused parameter 2: 84611483 = 2: 84611483 src/logoutd.c: Remove unused variable 3: c659e125 = 3: c659e125 src/login.c: Remove dead code 4: 90d7f3bf = 4: 90d7f3bf lib/, src/: Reduce scope of local variables 5: 05a0c1bc = 5: 05a0c1bc lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 861e3c89 = 6: 861e3c89 lib/getdate.y: NULL doesn't need a cast 7: 8e10fdca = 7: 8e10fdca lib/, src/: Always pass NULL to time(2) 8: 83bb6e13 = 8: 83bb6e13 lib/failure.c: failprint(): Remove dead code 9: c50f671d = 9: c50f671d lib/Makefile.am: Add missing file 10: f290e305 = 10: f290e305 lib/, src/: Add missing include 11: f206979e = 11: f206979e lib/: Use REALLOCF() instead of its pattern 12: 7b7271c2 = 12: 7b7271c2 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: bbcbd7bd = 13: 79e8208f lib/, src/: Use strchrnul(3) instead of its pattern 14: 42b086b5 = 14: d8c17e5c src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: 3f75d467 = 15: 058435e3 lib/, src/: Use strsep(3) instead of its pattern 16: 80183769 = 16: 893f35f2 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: ea22f334 = 17: 465e9753 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: ad3fbd48 = 18: dbc294f1 src/groupmems.c: Fix number of elements in allocation 19: 2bed0218 = 19: d2f82dc7 src/: Use xasprintf() instead of its pattern 20: d4167425 = 20: e0087179 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: b889fb88 = 21: 39345d8e lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: 71db0210 = 22: a42aa280 lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: 942b5949 = 23: 32caf54b lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: 009a1093 = 24: b11b542d src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: fc49ee04 < -: -------- lib/string/zustr2stp.h: Simplify ZUSTR2STP() and its documentation 26: 363a72c5 ! 25: 0fc70484 tests/unit/test_zustr2stp.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() @@ Metadata Author: Alejandro Colomarv14b
- Rebase ``` $ git range-diff master..gh/reduce shadow/master..reduce 1: dac868b2 = 1: 39fcc072 src/su.c: save_caller_context(): Remove unused parameter 2: 84611483 = 2: ffd280ac src/logoutd.c: Remove unused variable 3: c659e125 ! 3: 69c7f0d1 src/login.c: Remove dead code @@ Commit message ## src/login.c ## @@ src/login.c: int main (int argc, char **argv) - + max_size = login_name_max_size(); assert (NULL == username); username = XMALLOC(max_size, char); - username[max_size - 1] = '\0'; 4: 90d7f3bf = 4: 168d9fce lib/, src/: Reduce scope of local variables 5: 05a0c1bc = 5: 97cb8a87 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 861e3c89 = 6: 7b5345dc lib/getdate.y: NULL doesn't need a cast 7: 8e10fdca = 7: cd1ed7ad lib/, src/: Always pass NULL to time(2) 8: 83bb6e13 = 8: 92ffd93c lib/failure.c: failprint(): Remove dead code 9: c50f671d = 9: a77f8284 lib/Makefile.am: Add missing file 10: f290e305 = 10: 264c36ad lib/, src/: Add missing include 11: f206979e = 11: 9b3cc4d9 lib/: Use REALLOCF() instead of its pattern 12: 7b7271c2 = 12: d1ddac40 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: 79e8208f = 13: b438cd0f lib/, src/: Use strchrnul(3) instead of its pattern 14: d8c17e5c = 14: 4ff6b399 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: 058435e3 = 15: 975aee74 lib/, src/: Use strsep(3) instead of its pattern 16: 893f35f2 = 16: 1e28b7af lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: 465e9753 = 17: 6e26f5f2 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: dbc294f1 = 18: b0f601e5 src/groupmems.c: Fix number of elements in allocation 19: d2f82dc7 = 19: 6bc75bd1 src/: Use xasprintf() instead of its pattern 20: e0087179 = 20: 8131b8d6 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: 39345d8e = 21: 93991ac8 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: a42aa280 = 22: 197e174c lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: 32caf54b = 23: 756e2885 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: b11b542d = 24: 918df02e src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: 0fc70484 = 25: 7ff4c250 tests/unit/test_zustr2str.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: cd5903c5 = 26: 7fe6504d lib/string/strncat.[ch]: STRNCAT(): Add macro 27: a7f17b13 = 27: 2072bba3 lib/string/: Remove ZUSTR2STP, and reimplement ZUSTR2STR() 28: 7e87bccb = 28: 40ef9e1e src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 29: a81ac44d = 29: 55119d1e src/logoutd.c: Use STRNCAT() instead of its pattern ```v15
- Fix test ``` $ git range-diff shadow/master gh/reduce reduce 1: 39fcc072 = 1: 39fcc072 src/su.c: save_caller_context(): Remove unused parameter 2: ffd280ac = 2: ffd280ac src/logoutd.c: Remove unused variable 3: 69c7f0d1 = 3: 69c7f0d1 src/login.c: Remove dead code 4: 168d9fce = 4: 168d9fce lib/, src/: Reduce scope of local variables 5: 97cb8a87 = 5: 97cb8a87 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 7b5345dc = 6: 7b5345dc lib/getdate.y: NULL doesn't need a cast 7: cd1ed7ad = 7: cd1ed7ad lib/, src/: Always pass NULL to time(2) 8: 92ffd93c = 8: 92ffd93c lib/failure.c: failprint(): Remove dead code 9: a77f8284 = 9: a77f8284 lib/Makefile.am: Add missing file 10: 264c36ad = 10: 264c36ad lib/, src/: Add missing include 11: 9b3cc4d9 = 11: 9b3cc4d9 lib/: Use REALLOCF() instead of its pattern 12: d1ddac40 = 12: d1ddac40 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: b438cd0f = 13: b438cd0f lib/, src/: Use strchrnul(3) instead of its pattern 14: 4ff6b399 = 14: 4ff6b399 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: 975aee74 = 15: 975aee74 lib/, src/: Use strsep(3) instead of its pattern 16: 1e28b7af = 16: 1e28b7af lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: 6e26f5f2 = 17: 6e26f5f2 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: b0f601e5 = 18: b0f601e5 src/groupmems.c: Fix number of elements in allocation 19: 6bc75bd1 = 19: 6bc75bd1 src/: Use xasprintf() instead of its pattern 20: 8131b8d6 = 20: 8131b8d6 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: 93991ac8 = 21: 93991ac8 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: 197e174c = 22: 197e174c lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: 756e2885 = 23: 756e2885 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: 918df02e = 24: 918df02e src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: 7ff4c250 = 25: 7ff4c250 tests/unit/test_zustr2str.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: 7fe6504d = 26: 7fe6504d lib/string/strncat.[ch]: STRNCAT(): Add macro 27: 2072bba3 = 27: 2072bba3 lib/string/: Remove ZUSTR2STP, and reimplement ZUSTR2STR() 28: 40ef9e1e = 28: 40ef9e1e src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 29: 55119d1e = 29: 55119d1e src/logoutd.c: Use STRNCAT() instead of its pattern -: -------- > 30: 0f43c3ac tests/unit/test_zustr2str.c: Remove incorrect use of address-of operator ```v15b
- Rebase ``` $ git range-diff master..gh/reduce shadow/master..reduce 1: 39fcc072 = 1: de8b169c src/su.c: save_caller_context(): Remove unused parameter 2: ffd280ac = 2: 3938fa6c src/logoutd.c: Remove unused variable 3: 69c7f0d1 = 3: a871c1d4 src/login.c: Remove dead code 4: 168d9fce = 4: bb25bcd8 lib/, src/: Reduce scope of local variables 5: 97cb8a87 = 5: 1e641706 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 7b5345dc = 6: d5303a0a lib/getdate.y: NULL doesn't need a cast 7: cd1ed7ad = 7: 09e504a3 lib/, src/: Always pass NULL to time(2) 8: 92ffd93c = 8: 6cae888e lib/failure.c: failprint(): Remove dead code 9: a77f8284 = 9: 83a3b1fa lib/Makefile.am: Add missing file 10: 264c36ad = 10: 790131ac lib/, src/: Add missing include 11: 9b3cc4d9 = 11: 8ccea38d lib/: Use REALLOCF() instead of its pattern 12: d1ddac40 = 12: f367a452 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: b438cd0f = 13: bc5426c9 lib/, src/: Use strchrnul(3) instead of its pattern 14: 4ff6b399 = 14: 8e657c25 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: 975aee74 = 15: f4cf38a3 lib/, src/: Use strsep(3) instead of its pattern 16: 1e28b7af = 16: e5f93921 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: 6e26f5f2 = 17: 41fd6524 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: b0f601e5 = 18: 81686469 src/groupmems.c: Fix number of elements in allocation 19: 6bc75bd1 = 19: fbc7d905 src/: Use xasprintf() instead of its pattern 20: 8131b8d6 = 20: e5a83ca0 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: 93991ac8 = 21: 579e67a0 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: 197e174c = 22: 47530be0 lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: 756e2885 = 23: f4f1807b lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: 918df02e = 24: d851bfc6 src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: 7ff4c250 = 25: e83829cc tests/unit/test_zustr2str.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: 7fe6504d = 26: 8e58326f lib/string/strncat.[ch]: STRNCAT(): Add macro 27: 2072bba3 = 27: 9c02fcce lib/string/: Remove ZUSTR2STP, and reimplement ZUSTR2STR() 28: 40ef9e1e = 28: bfa46d80 src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 29: 55119d1e = 29: 1b5eabbb src/logoutd.c: Use STRNCAT() instead of its pattern 30: 0f43c3ac = 30: 0354c3e6 tests/unit/test_zustr2str.c: Remove incorrect use of address-of operator ```v15c
- The program wasn't passing NULL to crypt(3); I misread. Still, fixing ENOMEM is good, so just change the wording of the commit message. ``` $ git range-diff shadow/master gh/reduce reduce 1: de8b169c = 1: de8b169c src/su.c: save_caller_context(): Remove unused parameter 2: 3938fa6c = 2: 3938fa6c src/logoutd.c: Remove unused variable 3: a871c1d4 = 3: a871c1d4 src/login.c: Remove dead code 4: bb25bcd8 = 4: bb25bcd8 lib/, src/: Reduce scope of local variables 5: 1e641706 = 5: 1e641706 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: d5303a0a = 6: d5303a0a lib/getdate.y: NULL doesn't need a cast 7: 09e504a3 = 7: 09e504a3 lib/, src/: Always pass NULL to time(2) 8: 6cae888e = 8: 6cae888e lib/failure.c: failprint(): Remove dead code 9: 83a3b1fa = 9: 83a3b1fa lib/Makefile.am: Add missing file 10: 790131ac = 10: 790131ac lib/, src/: Add missing include 11: 8ccea38d = 11: 8ccea38d lib/: Use REALLOCF() instead of its pattern 12: f367a452 = 12: f367a452 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: bc5426c9 = 13: bc5426c9 lib/, src/: Use strchrnul(3) instead of its pattern 14: 8e657c25 = 14: 8e657c25 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: f4cf38a3 = 15: f4cf38a3 lib/, src/: Use strsep(3) instead of its pattern 16: e5f93921 = 16: e5f93921 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: 41fd6524 = 17: 41fd6524 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: 81686469 = 18: 81686469 src/groupmems.c: Fix number of elements in allocation 19: fbc7d905 = 19: fbc7d905 src/: Use xasprintf() instead of its pattern 20: e5a83ca0 = 20: e5a83ca0 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: 579e67a0 = 21: 579e67a0 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: 47530be0 = 22: 47530be0 lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: f4f1807b = 23: f4f1807b lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: d851bfc6 = 24: d851bfc6 src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: e83829cc = 25: e83829cc tests/unit/test_zustr2str.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() 26: 8e58326f = 26: 8e58326f lib/string/strncat.[ch]: STRNCAT(): Add macro 27: 9c02fcce = 27: 9c02fcce lib/string/: Remove ZUSTR2STP, and reimplement ZUSTR2STR() 28: bfa46d80 ! 28: 0c035be9 src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) @@ Metadata ## Commit message ## src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) - The program was happily passing the result of strdup(3) to functions - that don't accept NULL --such as crypt(3), via add_passwd()--. + The program was happily ignoring ENOMEM errors. Fixes: 7f9e19690333 ("* NEWS, src/newusers.c, src/Makefile.am: Added support for") Signed-off-by: Alejandro Colomarv15d
- Rebase ``` $ git range-diff master..gh/reduce shadow/master..reduce 1: de8b169c = 1: 709bc0df src/su.c: save_caller_context(): Remove unused parameter 2: 3938fa6c = 2: 72990305 src/logoutd.c: Remove unused variable 3: a871c1d4 ! 3: b4877471 src/login.c: Remove dead code @@ Commit message Signed-off-by: Alejandro Colomarv16
- Remove ZUSTR2STR(). ``` $ git range-diff master gh/reduce reduce 1: 709bc0df = 1: 709bc0df src/su.c: save_caller_context(): Remove unused parameter 2: 72990305 = 2: 72990305 src/logoutd.c: Remove unused variable 3: b4877471 = 3: b4877471 src/login.c: Remove dead code 4: c416543e = 4: c416543e lib/, src/: Reduce scope of local variables 5: 31d7e5af = 5: 31d7e5af lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 677d6916 = 6: 677d6916 lib/getdate.y: NULL doesn't need a cast 7: 95adfa83 = 7: 95adfa83 lib/, src/: Always pass NULL to time(2) 8: e05b02d2 = 8: e05b02d2 lib/failure.c: failprint(): Remove dead code 9: a7524c39 = 9: a7524c39 lib/Makefile.am: Add missing file 10: e20fd4df = 10: e20fd4df lib/, src/: Add missing include 11: 4a44ca03 = 11: 4a44ca03 lib/: Use REALLOCF() instead of its pattern 12: a6694ddd = 12: a6694ddd lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: 2e0b6713 = 13: 2e0b6713 lib/, src/: Use strchrnul(3) instead of its pattern 14: 62ecae43 = 14: 62ecae43 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: ef0a3386 = 15: ef0a3386 lib/, src/: Use strsep(3) instead of its pattern 16: 9d20c71d = 16: 9d20c71d lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: ddc4a5ae = 17: ddc4a5ae lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: 7651e87e = 18: 7651e87e src/groupmems.c: Fix number of elements in allocation 19: 4e1d422a = 19: 4e1d422a src/: Use xasprintf() instead of its pattern 20: 51dc60f7 = 20: 51dc60f7 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: c80dee37 = 21: c80dee37 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: ee8390d1 = 22: ee8390d1 lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: 48c36644 = 23: 48c36644 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: 450e4145 = 24: 450e4145 src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: 4023a1f0 < -: -------- tests/unit/test_zustr2str.c: Repurpose ZUSTR2STP() tests for ZUSTR2STR() -: -------- > 25: fcd53135 tests/unit/test_strncat.c: Remove tests for ZUSTR2STP() 26: ac7d198e = 26: fbeaa341 lib/string/strncat.[ch]: STRNCAT(): Add macro 27: bf50bae2 ! 27: 1e4267b2 lib/string/: Remove ZUSTR2STP, and reimplement ZUSTR2STR() @@ lib/string/zustr2stp.h (deleted) - -#endif // include guard - ## tests/unit/test_zustr2str.c ## + ## tests/unit/test_strncat.c (new) ## @@ - #includev17
- Actually remove tests for ZUSTR2STR() (accidentally kept in previous revision). ``` $ git range-diff master gh/reduce reduce 1: 709bc0df = 1: 709bc0df src/su.c: save_caller_context(): Remove unused parameter 2: 72990305 = 2: 72990305 src/logoutd.c: Remove unused variable 3: b4877471 = 3: b4877471 src/login.c: Remove dead code 4: c416543e = 4: c416543e lib/, src/: Reduce scope of local variables 5: 31d7e5af = 5: 31d7e5af lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 677d6916 = 6: 677d6916 lib/getdate.y: NULL doesn't need a cast 7: 95adfa83 = 7: 95adfa83 lib/, src/: Always pass NULL to time(2) 8: e05b02d2 = 8: e05b02d2 lib/failure.c: failprint(): Remove dead code 9: a7524c39 = 9: a7524c39 lib/Makefile.am: Add missing file 10: e20fd4df = 10: e20fd4df lib/, src/: Add missing include 11: 4a44ca03 = 11: 4a44ca03 lib/: Use REALLOCF() instead of its pattern 12: a6694ddd = 12: a6694ddd lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: 2e0b6713 = 13: 2e0b6713 lib/, src/: Use strchrnul(3) instead of its pattern 14: 62ecae43 = 14: 62ecae43 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: ef0a3386 = 15: ef0a3386 lib/, src/: Use strsep(3) instead of its pattern 16: 9d20c71d = 16: 9d20c71d lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: ddc4a5ae = 17: ddc4a5ae lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: 7651e87e = 18: 7651e87e src/groupmems.c: Fix number of elements in allocation 19: 4e1d422a = 19: 4e1d422a src/: Use xasprintf() instead of its pattern 20: 51dc60f7 = 20: 51dc60f7 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: c80dee37 = 21: c80dee37 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: ee8390d1 = 22: ee8390d1 lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: 48c36644 = 23: 48c36644 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: 450e4145 = 24: 450e4145 src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: fcd53135 = 25: fcd53135 tests/unit/test_strncat.c: Remove tests for ZUSTR2STP() 26: fbeaa341 = 26: fbeaa341 lib/string/strncat.[ch]: STRNCAT(): Add macro 27: 1e4267b2 ! 27: 8a092f83 lib/string/: Remove ZUSTR2STP, and reimplement ZUSTR2STR() @@ lib/string/zustr2stp.h (deleted) - - -#endif // include guard - - ## tests/unit/test_strncat.c (new) ## -@@ -+// SPDX-FileCopyrightText: 2024, Alejandro Colomarv18
- Add STRNDUPA() (like XSTRNDUP(), but use alloca(3)) ``` $ git range-diff master gh/reduce reduce 1: 709bc0df = 1: 709bc0df src/su.c: save_caller_context(): Remove unused parameter 2: 72990305 = 2: 72990305 src/logoutd.c: Remove unused variable 3: b4877471 = 3: b4877471 src/login.c: Remove dead code 4: c416543e = 4: c416543e lib/, src/: Reduce scope of local variables 5: 31d7e5af = 5: 31d7e5af lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 677d6916 = 6: 677d6916 lib/getdate.y: NULL doesn't need a cast 7: 95adfa83 = 7: 95adfa83 lib/, src/: Always pass NULL to time(2) 8: e05b02d2 = 8: e05b02d2 lib/failure.c: failprint(): Remove dead code 9: a7524c39 = 9: a7524c39 lib/Makefile.am: Add missing file 10: e20fd4df = 10: e20fd4df lib/, src/: Add missing include 11: 4a44ca03 = 11: 4a44ca03 lib/: Use REALLOCF() instead of its pattern 12: a6694ddd = 12: a6694ddd lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 13: 2e0b6713 = 13: 2e0b6713 lib/, src/: Use strchrnul(3) instead of its pattern 14: 62ecae43 = 14: 62ecae43 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 15: ef0a3386 = 15: ef0a3386 lib/, src/: Use strsep(3) instead of its pattern 16: 9d20c71d = 16: 9d20c71d lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 17: ddc4a5ae = 17: ddc4a5ae lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 18: 7651e87e = 18: 7651e87e src/groupmems.c: Fix number of elements in allocation 19: 4e1d422a = 19: 4e1d422a src/: Use xasprintf() instead of its pattern 20: 51dc60f7 = 20: 51dc60f7 lib/string/zustr2stp.h: ZUSTR2STR(): Add macro 21: c80dee37 = 21: c80dee37 lib/string/strndup.[ch]: XSTRNDUP(): Add macro 22: ee8390d1 = 22: ee8390d1 lib/utmp.c: Use XSTRNDUP() instead of its pattern 23: 48c36644 = 23: 48c36644 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 24: 450e4145 = 24: 450e4145 src/logoutd.c: Replace ZUSTR2STP() calls by XSTRNDUP() 25: fcd53135 = 25: fcd53135 tests/unit/test_strncat.c: Remove tests for ZUSTR2STP() 26: fbeaa341 = 26: fbeaa341 lib/string/strncat.[ch]: STRNCAT(): Add macro 27: 8a092f83 = 27: 8a092f83 lib/string/: Remove ZUSTR2STP, and reimplement ZUSTR2STR() 28: 7ebcb836 = 28: 7ebcb836 lib/string/: Remove ZUSTR2STR() 29: de20fbcf = 29: de20fbcf src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 30: f9e184ef = 30: f9e184ef src/logoutd.c: Use STRNCAT() instead of its pattern -: -------- > 31: a6c63387 lib/string/strndup.h: STRNDUPA(): Add macro -: -------- > 32: 74f842fa src/logoutd.c: Replace XSTRNDUP() by STRNDUPA() ```v19
- Squash commits ```diff $ git diff --stat -p gh/reduce..reduce lib/string/strncat.h | 2 +- lib/string/strndup.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/string/strncat.h b/lib/string/strncat.h index 33d6e786..48e3d727 100644 --- a/lib/string/strncat.h +++ b/lib/string/strncat.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomarv20
- Rebase of top ofv21
- Reorganize allocation APIs ```$ git range-diff master gh/reduce reduce 1: abdf883b = 1: abdf883b lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: 66b96d18 = 2: 66b96d18 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 90565c02 = 3: 90565c02 lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: 4656be21 = 4: 4656be21 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 4126dc6d src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 73dd8d51 src/login.c: Remove dead code 7: d90e3d41 = 7: d90e3d41 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: bddb2fb8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: fa24d39c = 9: fa24d39c lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: c6248055 lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: af7e86a4 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: 8883ae25 lib/, src/: Add missing include 13: 07e8283d = 13: 07e8283d lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: 42ae190d lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 1c9a8b07 = 15: 1c9a8b07 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: 663d8080 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 9f711879 = 17: 9f711879 lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: cac3d090 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 263cd776 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 101a3ba4 = 20: 101a3ba4 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: 3fed2ab8 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: 385cc686 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 793645e3 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: c4e43a0c lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: 8bb064e7 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: ded0e05c = 26: ded0e05c src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9a5673a0 = 27: 9a5673a0 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: 58298454 src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 30fc5b0d lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 744125ed = 30: 744125ed lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file -: -------- > 31: db5fac61 lib/alloc.[ch]: xmalloc(): Remove unused function -: -------- > 32: c66b191f lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory ```v21b
- Add missing includes ``` $ git range-diff master gh/reduce reduce 1: abdf883b = 1: abdf883b lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: 66b96d18 = 2: 66b96d18 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 90565c02 = 3: 90565c02 lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: 4656be21 = 4: 4656be21 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 4126dc6d src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 73dd8d51 src/login.c: Remove dead code 7: d90e3d41 = 7: d90e3d41 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: bddb2fb8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: fa24d39c = 9: fa24d39c lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: c6248055 lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: af7e86a4 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: 8883ae25 lib/, src/: Add missing include 13: 07e8283d = 13: 07e8283d lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: 42ae190d lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 1c9a8b07 = 15: 1c9a8b07 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: 663d8080 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 9f711879 = 17: 9f711879 lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: cac3d090 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 263cd776 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 101a3ba4 = 20: 101a3ba4 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: 3fed2ab8 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: 385cc686 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 793645e3 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: c4e43a0c lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: 8bb064e7 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: ded0e05c = 26: ded0e05c src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9a5673a0 = 27: 9a5673a0 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: 58298454 src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 30fc5b0d lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 744125ed = 30: 744125ed lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: db5fac61 = 31: db5fac61 lib/alloc.[ch]: xmalloc(): Remove unused function 32: c66b191f ! 32: a1377ba6 lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory @@ lib/alloc/x/xcalloc.c (new) +#includev21c
- Add missing include ``` $ git range-diff master gh/reduce reduce 1: abdf883b = 1: abdf883b lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: 66b96d18 = 2: 66b96d18 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 90565c02 = 3: 90565c02 lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: 4656be21 = 4: 4656be21 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 4126dc6d src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 73dd8d51 src/login.c: Remove dead code 7: d90e3d41 = 7: d90e3d41 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: bddb2fb8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: fa24d39c = 9: fa24d39c lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: c6248055 lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: af7e86a4 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: 8883ae25 lib/, src/: Add missing include 13: 07e8283d = 13: 07e8283d lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: 42ae190d lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 1c9a8b07 = 15: 1c9a8b07 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: 663d8080 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 9f711879 = 17: 9f711879 lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: cac3d090 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 263cd776 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 101a3ba4 = 20: 101a3ba4 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: 3fed2ab8 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: 385cc686 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 793645e3 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: c4e43a0c lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: 8bb064e7 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: ded0e05c = 26: ded0e05c src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9a5673a0 = 27: 9a5673a0 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: 58298454 src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 30fc5b0d lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 744125ed = 30: 744125ed lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: db5fac61 = 31: db5fac61 lib/alloc.[ch]: xmalloc(): Remove unused function 32: a1377ba6 ! 32: b6b04bbe lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory @@ lib/alloc/x/xcalloc.h (new) +#includev21d
- Add missing include ``` $ git range-diff master gh/reduce reduce 1: abdf883b = 1: abdf883b lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: 66b96d18 = 2: 66b96d18 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 90565c02 = 3: 90565c02 lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: 4656be21 = 4: 4656be21 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 4126dc6d src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 73dd8d51 src/login.c: Remove dead code 7: d90e3d41 = 7: d90e3d41 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: bddb2fb8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: fa24d39c = 9: fa24d39c lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: c6248055 lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: af7e86a4 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: 8883ae25 lib/, src/: Add missing include 13: 07e8283d = 13: 07e8283d lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: 42ae190d lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 1c9a8b07 = 15: 1c9a8b07 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: 663d8080 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 9f711879 = 17: 9f711879 lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: cac3d090 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 263cd776 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 101a3ba4 = 20: 101a3ba4 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: 3fed2ab8 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: 385cc686 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 793645e3 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: c4e43a0c lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: 8bb064e7 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: ded0e05c = 26: ded0e05c src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9a5673a0 = 27: 9a5673a0 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: 58298454 src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 30fc5b0d lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 744125ed = 30: 744125ed lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: db5fac61 = 31: db5fac61 lib/alloc.[ch]: xmalloc(): Remove unused function 32: b6b04bbe ! 32: 34e11853 lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory @@ src/vipw.c #include "defines.h" #include "getdef.h" #include "groupio.h" + + ## tests/unit/test_chkname.c ## +@@ + #includev22
- Cosmetic ``` $ git range-diff master gh/reduce reduce 1: abdf883b = 1: abdf883b lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: 66b96d18 = 2: 66b96d18 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 90565c02 = 3: 90565c02 lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: 4656be21 = 4: 4656be21 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 4126dc6d src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 73dd8d51 src/login.c: Remove dead code 7: d90e3d41 = 7: d90e3d41 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: bddb2fb8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: fa24d39c = 9: fa24d39c lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: c6248055 lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: af7e86a4 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: 8883ae25 lib/, src/: Add missing include 13: 07e8283d = 13: 07e8283d lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: 42ae190d lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 1c9a8b07 = 15: 1c9a8b07 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: 663d8080 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 9f711879 = 17: 9f711879 lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: cac3d090 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 263cd776 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 101a3ba4 = 20: 101a3ba4 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: 3fed2ab8 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: 385cc686 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 793645e3 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: c4e43a0c lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: 8bb064e7 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: ded0e05c = 26: ded0e05c src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9a5673a0 = 27: 9a5673a0 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: 58298454 src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 30fc5b0d lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 744125ed = 30: 744125ed lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: db5fac61 = 31: db5fac61 lib/alloc.[ch]: xmalloc(): Remove unused function 32: 34e11853 = 32: 34e11853 lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory -: -------- > 33: 0830f897 lib/alloc/: Use multi-line macro definitions ```v22b
- Some more cosmetic ``` $ git range-diff master gh/reduce reduce 1: abdf883b = 1: abdf883b lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf> 2: 66b96d18 = 2: 66b96d18 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(> 3: 90565c02 = 3: 90565c02 lib/string/strcpy/, lib/, src/, tests/: Move all copying A> 4: 4656be21 = 4: 4656be21 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 4126dc6d src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 73dd8d51 src/login.c: Remove dead code 7: d90e3d41 = 7: d90e3d41 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: bddb2fb8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning> 9: fa24d39c = 9: fa24d39c lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: c6248055 lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: af7e86a4 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: 8883ae25 lib/, src/: Add missing include 13: 07e8283d = 13: 07e8283d lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: 42ae190d lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() a> 15: 1c9a8b07 = 15: 1c9a8b07 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: 663d8080 src/useradd.c: tallylog_reset(): Use Basename() instead of> 17: 9f711879 = 17: 9f711879 lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: cac3d090 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 263cd776 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculati> 20: 101a3ba4 = 20: 101a3ba4 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: 3fed2ab8 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: 385cc686 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 793645e3 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: c4e43a0c lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: 8bb064e7 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its p> 26: ded0e05c = 26: ded0e05c src/newusers.c: Exit on ENOMEM, by calling xstrdup() inste> 27: 9a5673a0 = 27: 9a5673a0 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: 58298454 src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 30fc5b0d lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP> 30: 744125ed = 30: 744125ed lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup()> 31: db5fac61 = 31: db5fac61 lib/alloc.[ch]: xmalloc(): Remove unused function 32: 34e11853 = 32: 34e11853 lib/alloc/, lib/, src/: Organize the allocation APIs in a > 33: 0830f897 ! 33: f561d970 lib/alloc/: Use multi-line macro definitions @@ Metadata Author: Alejandro Colomarv23
- Use `[[gnu::alloc_size(...)]]`. Suggested by @uecker ``` $ git range-diff gh/master gh/reduce reduce 1: abdf883b = 1: abdf883b lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: 66b96d18 = 2: 66b96d18 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 90565c02 = 3: 90565c02 lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: 4656be21 = 4: 4656be21 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 4126dc6d src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 73dd8d51 src/login.c: Remove dead code 7: d90e3d41 = 7: d90e3d41 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: bddb2fb8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: fa24d39c = 9: fa24d39c lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: c6248055 lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: af7e86a4 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: 8883ae25 lib/, src/: Add missing include 13: 07e8283d = 13: 07e8283d lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: 42ae190d lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 1c9a8b07 = 15: 1c9a8b07 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: 663d8080 src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 9f711879 = 17: 9f711879 lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: cac3d090 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 263cd776 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 101a3ba4 = 20: 101a3ba4 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: 3fed2ab8 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: 385cc686 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 793645e3 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: c4e43a0c lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: 8bb064e7 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: ded0e05c = 26: ded0e05c src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9a5673a0 = 27: 9a5673a0 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: 58298454 src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 30fc5b0d lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 744125ed = 30: 744125ed lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: db5fac61 = 31: db5fac61 lib/alloc.[ch]: xmalloc(): Remove unused function 32: 34e11853 = 32: 34e11853 lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory 33: f561d970 = 33: f561d970 lib/: Use multi-line macro definitions -: -------- > 34: 379ceb8a lib/: Use [[gnu::alloc_size(...)]] on allocation functions ```v23b
- Rebase ``` $ git range-diff gh/master..gh/reduce master..reduce 1: abdf883b = 1: c13092b6 lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: 66b96d18 = 2: dc6da914 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 90565c02 = 3: 0bbfc60f lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: 4656be21 = 4: b1e5b495 src/su.c: save_caller_context(): Remove unused parameter 5: 4126dc6d = 5: 17858327 src/logoutd.c: Remove unused variable 6: 73dd8d51 = 6: 0aa71ca2 src/login.c: Remove dead code 7: d90e3d41 = 7: 2bbbba50 lib/, src/: Reduce scope of local variables 8: bddb2fb8 = 8: 96801f9d lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: fa24d39c = 9: 18cc63d8 lib/getdate.y: NULL doesn't need a cast 10: c6248055 = 10: 3aedb0ad lib/, src/: Always pass NULL to time(2) 11: af7e86a4 = 11: 164398a9 lib/failure.c: failprint(): Remove dead code 12: 8883ae25 = 12: f5c8ee8f lib/, src/: Add missing include 13: 07e8283d = 13: 11918f63 lib/: Use REALLOCF() instead of its pattern 14: 42ae190d = 14: f0b8f9d6 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 1c9a8b07 = 15: 37dcf589 lib/, src/: Use strchrnul(3) instead of its pattern 16: 663d8080 = 16: bf3771bc src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 9f711879 = 17: 22b0ac3d lib/, src/: Use strsep(3) instead of its pattern 18: cac3d090 = 18: a0fd4cae lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 263cd776 = 19: 50a3a54f lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 101a3ba4 = 20: 950eba91 src/groupmems.c: Fix number of elements in allocation 21: 3fed2ab8 = 21: c4b53222 src/: Use xasprintf() instead of its pattern 22: 385cc686 = 22: d85f6ba1 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 793645e3 = 23: 292ab211 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: c4e43a0c = 24: 79cc1d6f lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: 8bb064e7 = 25: ea1a8731 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: ded0e05c = 26: c7a3c0ba src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9a5673a0 = 27: 9d3b58f9 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: 58298454 = 28: de250fdd src/logoutd.c: Use STRNCAT() instead of its pattern 29: 30fc5b0d = 29: 18278e59 lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 744125ed = 30: 038c41a1 lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: db5fac61 = 31: 8b6b43a6 lib/alloc.[ch]: xmalloc(): Remove unused function 32: 34e11853 = 32: 3ce45553 lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory 33: f561d970 = 33: b06742e4 lib/: Use multi-line macro definitions 34: 379ceb8a = 34: 12718eca lib/: Use [[gnu::alloc_size(...)]] on allocation functions ```v24
- XREALLOC() instead of passing a NULL that nobody checks. @hallyn - Remove dead code. @hallyn ``` $ git range-diff shadow/master gh/reduce reduce 1: c13092b6 = 1: c13092b6 lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: dc6da914 = 2: dc6da914 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 0bbfc60f = 3: 0bbfc60f lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: b1e5b495 = 4: b1e5b495 src/su.c: save_caller_context(): Remove unused parameter 5: 17858327 = 5: 17858327 src/logoutd.c: Remove unused variable 6: 0aa71ca2 = 6: 0aa71ca2 src/login.c: Remove dead code 7: 2bbbba50 = 7: 2bbbba50 lib/, src/: Reduce scope of local variables 8: 96801f9d = 8: 96801f9d lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: 18cc63d8 = 9: 18cc63d8 lib/getdate.y: NULL doesn't need a cast 10: 3aedb0ad = 10: 3aedb0ad lib/, src/: Always pass NULL to time(2) 11: 164398a9 = 11: 164398a9 lib/failure.c: failprint(): Remove dead code 12: f5c8ee8f = 12: f5c8ee8f lib/, src/: Add missing include 13: 11918f63 = 13: 11918f63 lib/: Use REALLOCF() instead of its pattern 14: f0b8f9d6 = 14: f0b8f9d6 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 37dcf589 = 15: 37dcf589 lib/, src/: Use strchrnul(3) instead of its pattern 16: bf3771bc = 16: bf3771bc src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 22b0ac3d = 17: 22b0ac3d lib/, src/: Use strsep(3) instead of its pattern 18: a0fd4cae = 18: a0fd4cae lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 50a3a54f = 19: 50a3a54f lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 950eba91 = 20: 950eba91 src/groupmems.c: Fix number of elements in allocation 21: c4b53222 = 21: c4b53222 src/: Use xasprintf() instead of its pattern 22: d85f6ba1 = 22: d85f6ba1 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 292ab211 = 23: 292ab211 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: 79cc1d6f = 24: 79cc1d6f lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: ea1a8731 = 25: ea1a8731 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: c7a3c0ba = 26: c7a3c0ba src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9d3b58f9 = 27: 9d3b58f9 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: de250fdd = 28: de250fdd src/logoutd.c: Use STRNCAT() instead of its pattern 29: 18278e59 = 29: 18278e59 lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 038c41a1 = 30: 038c41a1 lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: 8b6b43a6 = 31: 8b6b43a6 lib/alloc.[ch]: xmalloc(): Remove unused function 32: 3ce45553 = 32: 3ce45553 lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory 33: b06742e4 = 33: b06742e4 lib/: Use multi-line macro definitions 34: 12718eca = 34: 12718eca lib/: Use [[gnu::alloc_size(...)]] on allocation functions -: -------- > 35: d3b335ce src/: Remove dead code -: -------- > 36: 9d2acca4 lib/gshadow.c: Use XREALLOC() instead of silently continuing on ENOMEM ```v25
- Use C2x attributes. ``` $ git range-diff shadow/master gh/reduce reduce 1: c13092b6 = 1: c13092b6 lib/string/seprintf.[ch], lib/, src/: Rename [v]stpeprintf() to [v]seprintf() 2: dc6da914 = 2: dc6da914 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 3: 0bbfc60f = 3: 0bbfc60f lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 4: b1e5b495 = 4: b1e5b495 src/su.c: save_caller_context(): Remove unused parameter 5: 17858327 = 5: 17858327 src/logoutd.c: Remove unused variable 6: 0aa71ca2 = 6: 0aa71ca2 src/login.c: Remove dead code 7: 2bbbba50 = 7: 2bbbba50 lib/, src/: Reduce scope of local variables 8: 96801f9d = 8: 96801f9d lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 9: 18cc63d8 = 9: 18cc63d8 lib/getdate.y: NULL doesn't need a cast 10: 3aedb0ad = 10: 3aedb0ad lib/, src/: Always pass NULL to time(2) 11: 164398a9 = 11: 164398a9 lib/failure.c: failprint(): Remove dead code 12: f5c8ee8f = 12: f5c8ee8f lib/, src/: Add missing include 13: 11918f63 = 13: 11918f63 lib/: Use REALLOCF() instead of its pattern 14: f0b8f9d6 = 14: f0b8f9d6 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 15: 37dcf589 = 15: 37dcf589 lib/, src/: Use strchrnul(3) instead of its pattern 16: bf3771bc = 16: bf3771bc src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 17: 22b0ac3d = 17: 22b0ac3d lib/, src/: Use strsep(3) instead of its pattern 18: a0fd4cae = 18: a0fd4cae lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 19: 50a3a54f = 19: 50a3a54f lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 20: 950eba91 = 20: 950eba91 src/groupmems.c: Fix number of elements in allocation 21: c4b53222 = 21: c4b53222 src/: Use xasprintf() instead of its pattern 22: d85f6ba1 = 22: d85f6ba1 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 23: 292ab211 = 23: 292ab211 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 24: 79cc1d6f = 24: 79cc1d6f lib/utmp.c: Use XSTRNDUP() instead of its pattern 25: ea1a8731 = 25: ea1a8731 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 26: c7a3c0ba = 26: c7a3c0ba src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 27: 9d3b58f9 = 27: 9d3b58f9 src/logoutd.c: Use STRNDUPA() instead of its pattern 28: de250fdd = 28: de250fdd src/logoutd.c: Use STRNCAT() instead of its pattern 29: 18278e59 = 29: 18278e59 lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 30: 038c41a1 = 30: 038c41a1 lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 31: 8b6b43a6 = 31: 8b6b43a6 lib/alloc.[ch]: xmalloc(): Remove unused function 32: 3ce45553 = 32: 3ce45553 lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory 33: b06742e4 = 33: b06742e4 lib/: Use multi-line macro definitions 34: 12718eca = 34: 12718eca lib/: Use [[gnu::alloc_size(...)]] on allocation functions 35: d3b335ce = 35: d3b335ce src/: Remove dead code 36: 9d2acca4 = 36: 9d2acca4 lib/gshadow.c: Use XREALLOC() instead of silently continuing on ENOMEM -: -------- > 37: 9c56c758 lib/attr.h: Use C23-style attributes ```v25b
- Rebase ``` $ git range-diff b1e5b495^..gh/reduce seprintf..reduce 1: b1e5b495 = 1: 8299f066 src/su.c: save_caller_context(): Remove unused parameter 2: 17858327 = 2: 7040a7b8 src/logoutd.c: Remove unused variable 3: 0aa71ca2 = 3: a013e53b src/login.c: Remove dead code 4: 2bbbba50 = 4: 21589bfa lib/, src/: Reduce scope of local variables 5: 96801f9d = 5: 56076206 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 18cc63d8 = 6: 9a99731a lib/getdate.y: NULL doesn't need a cast 7: 3aedb0ad = 7: 860e847c lib/, src/: Always pass NULL to time(2) 8: 164398a9 = 8: 5763795d lib/failure.c: failprint(): Remove dead code 9: f5c8ee8f = 9: 3bca72d7 lib/, src/: Add missing include 10: 11918f63 = 10: 1026842d lib/: Use REALLOCF() instead of its pattern 11: f0b8f9d6 = 11: 6ae47f59 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 12: 37dcf589 = 12: 5f108154 lib/, src/: Use strchrnul(3) instead of its pattern 13: bf3771bc = 13: 4d3fbffd src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 14: 22b0ac3d = 14: 1a102a48 lib/, src/: Use strsep(3) instead of its pattern 15: a0fd4cae = 15: be514706 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 16: 50a3a54f = 16: cc57602c lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 17: 950eba91 = 17: 47702790 src/groupmems.c: Fix number of elements in allocation 18: c4b53222 = 18: 31783736 src/: Use xasprintf() instead of its pattern 19: d85f6ba1 = 19: f2a999f4 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 20: 292ab211 = 20: 3512409f lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 21: 79cc1d6f = 21: ffa347a3 lib/utmp.c: Use XSTRNDUP() instead of its pattern 22: ea1a8731 = 22: 7865355b lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 23: c7a3c0ba = 23: b0749bc9 src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 24: 9d3b58f9 = 24: 7154096e src/logoutd.c: Use STRNDUPA() instead of its pattern 25: de250fdd = 25: ecc01a44 src/logoutd.c: Use STRNCAT() instead of its pattern 26: 18278e59 = 26: 6292dc9a lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 27: 038c41a1 ! 27: e7153fc3 lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file @@ src/groupmems.c ## src/groupmod.c ## @@ #include "shadowlog.h" - #include "string/sprintf/seprintf.h" + #include "string/sprintf/stpeprintf.h" #include "string/strcpy/stpecpy.h" +#include "string/strdup/xstrdup.h" 28: 8b6b43a6 = 28: ee797c91 lib/alloc.[ch]: xmalloc(): Remove unused function 29: 3ce45553 ! 29: 9b50ae4a lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory @@ lib/idmapping.c +#include "alloc/x/xmalloc.h" #include "atoi/str2i.h" #include "prototypes.h" - #include "string/sprintf/seprintf.h" + #include "string/sprintf/stpeprintf.h" ## lib/list.c ## @@ 30: b06742e4 = 30: c8021de5 lib/: Use multi-line macro definitions 31: 12718eca = 31: 8d9ad6d8 lib/: Use [[gnu::alloc_size(...)]] on allocation functions 32: d3b335ce = 32: 8fa420ca src/: Remove dead code 33: 9d2acca4 = 33: 0b2aab42 lib/gshadow.c: Use XREALLOC() instead of silently continuing on ENOMEM 34: 9c56c758 = 34: 708ae1ef lib/attr.h: Use C23-style attributes ```v25c
- Rebase ``` $ git range-diff gh/seprintf..gh/reduce seprintf..reduce 1: 8299f066 = 1: 008d82c2 src/su.c: save_caller_context(): Remove unused parameter 2: 7040a7b8 = 2: a90402fb src/logoutd.c: Remove unused variable 3: a013e53b = 3: 29dfe54c src/login.c: Remove dead code 4: 21589bfa = 4: e5fd9d30 lib/, src/: Reduce scope of local variables 5: 56076206 = 5: 4d2e36e8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 6: 9a99731a = 6: 50c8d4e6 lib/getdate.y: NULL doesn't need a cast 7: 860e847c = 7: bbf3af27 lib/, src/: Always pass NULL to time(2) 8: 5763795d = 8: 669f7458 lib/failure.c: failprint(): Remove dead code 9: 3bca72d7 = 9: 8a81f1f7 lib/, src/: Add missing include 10: 1026842d = 10: 961de415 lib/: Use REALLOCF() instead of its pattern 11: 6ae47f59 = 11: c1ee3517 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 12: 5f108154 ! 12: ac449013 lib/, src/: Use strchrnul(3) instead of its pattern @@ lib/commonio.c -#includev36b
- Fix include in test. ``` $ git range-diff master gh/reduce reduce 1: 9c7d1b78 = 1: 9c7d1b78 lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory 2: 66eeb817 = 2: 66eeb817 lib/string/strcpy/, lib/, src/, tests/: Move all copying APIs to a subdirectory 3: 008d82c2 = 3: 008d82c2 src/su.c: save_caller_context(): Remove unused parameter 4: a90402fb = 4: a90402fb src/logoutd.c: Remove unused variable 5: 29dfe54c = 5: 29dfe54c src/login.c: Remove dead code 6: e5fd9d30 = 6: e5fd9d30 lib/, src/: Reduce scope of local variables 7: 4d2e36e8 = 7: 4d2e36e8 lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string 8: 50c8d4e6 = 8: 50c8d4e6 lib/getdate.y: NULL doesn't need a cast 9: bbf3af27 = 9: bbf3af27 lib/, src/: Always pass NULL to time(2) 10: 669f7458 = 10: 669f7458 lib/failure.c: failprint(): Remove dead code 11: 8a81f1f7 = 11: 8a81f1f7 lib/, src/: Add missing include 12: 961de415 = 12: 961de415 lib/: Use REALLOCF() instead of its pattern 13: c1ee3517 = 13: c1ee3517 lib/commonio.c: commonio_open(): MALLOC() and REALLOCF() already set ENOMEM 14: ac449013 = 14: ac449013 lib/, src/: Use strchrnul(3) instead of its pattern 15: ae3d490c = 15: ae3d490c src/useradd.c: tallylog_reset(): Use Basename() instead of its pattern 16: 47b9a92e = 16: 47b9a92e lib/, src/: Use strsep(3) instead of its pattern 17: f9108958 = 17: f9108958 lib/gshadow.c: build_list(): Fix forever loop on ENOMEM 18: a79a5b73 = 18: a79a5b73 lib/gshadow.c: build_list(): Fix REALLOC() nmemb calculation 19: 13b230ec = 19: 13b230ec src/groupmems.c: Fix number of elements in allocation 20: 7510b88a = 20: 7510b88a src/: Use xasprintf() instead of its pattern 21: 1d2acea1 = 21: 1d2acea1 lib/string/strcpy/strncat.[ch]: STRNCAT(): Add macro 22: 731dc5a0 = 22: 731dc5a0 lib/string/strdup/: XSTRNDUP(), STRNDUPA(): Add macros 23: 460b963e = 23: 460b963e lib/utmp.c: Use XSTRNDUP() instead of its pattern 24: 37b2e2f1 = 24: 37b2e2f1 lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern 25: d4f4d7dc = 25: d4f4d7dc src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) 26: 4c5135a1 = 26: 4c5135a1 src/logoutd.c: Use STRNDUPA() instead of its pattern 27: c4911572 = 27: c4911572 src/logoutd.c: Use STRNCAT() instead of its pattern 28: 4fbbd105 = 28: 4fbbd105 lib/string/strcpy/zustr2stp.[ch], tests/: Remove ZUSTR2STP() 29: c02222d9 = 29: c02222d9 lib/string/strdup/xstrdup.[ch], lib/, src/: Move xstrdup() to its own file 30: 986c2724 = 30: 986c2724 lib/alloc.[ch]: xmalloc(): Remove unused function 31: 149d8ca6 ! 31: 2d05f8ff lib/alloc/, lib/, src/: Organize the allocation APIs in a new subdirectory @@ Metadata Author: Alejandro Colomar