Module Name: src Committed By: martin Date: Sat Aug 24 16:15:40 UTC 2024
Modified Files: src/lib/libc/time [netbsd-9]: strptime.c src/tests/lib/libc/time [netbsd-9]: t_strptime.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #1881): lib/libc/time/strptime.c: revision 1.64 (patch) lib/libc/time/strptime.c: revision 1.65 (patch) lib/libc/time/strptime.c: revision 1.66 (patch) tests/lib/libc/time/t_strptime.c: revision 1.16 (patch) strptime(3): Exercise some edge cases in the automatic tests. Unfortunately, we can't quite use strptime as a black box to detect the cases that triggered undefined behaviour, because strptime just fails in that case anyway since the number that would go in .tm_year is far out of the representable range. PR lib/58041 strptime(3): Avoid arithmetic overflow. PR lib/58041 strptime(3): Reduce unnecessary indentation. Post-fix tidying. No functional change intended. PR lib/58041 strptime(3): Declare digit d as time_t. This doesn't make a semantic difference -- d can only take on the ten values {0,1,2,3,4,5,6,7,8,9}, and the arithmetic with it later all comes out the same whether the type is unsigned or time_t, even if time_t were int32_t instead of int64_t. But it pacifies overzealous compilers used by downstream users of this code. And while it's silly to use a much wider type (64-bit signed) than is needed here to store a single digit, it doesn't really hurt either (32-bit unsigned is much larger than needed too). PR lib/58041 To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.62.6.1 src/lib/libc/time/strptime.c cvs rdiff -u -r1.15 -r1.15.4.1 src/tests/lib/libc/time/t_strptime.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.