shadow-maint / shadow

Upstream shadow tree
Other
292 stars 228 forks source link

STRFTIME() #931

Closed alejandro-colomar closed 5 months ago

alejandro-colomar commented 7 months ago

v2 changes:

$ git range-diff shadow/master gh/STRFTIME STRFTIME 
1:  f8e21208 = 1:  f8e21208 lib/string/strftime.[ch]: STRFTIME(): Add macro
2:  145cecb2 = 2:  145cecb2 lib/, src/: Use STRFTIME() instead of its pattern
-:  -------- > 3:  490a0f85 src/login.c: Use localtime_r(3) instead of localtime(3)
alejandro-colomar commented 7 months ago

v2b changes:

$ git range-diff gh/master..gh/STRFTIME shadow/master..STRFTIME 
1:  f8e21208 = 1:  17a0e3b8 lib/string/strftime.[ch]: STRFTIME(): Add macro
2:  145cecb2 = 2:  11d9031f lib/, src/: Use STRFTIME() instead of its pattern
3:  490a0f85 = 3:  fab56737 src/login.c: Use localtime_r(3) instead of localtime(3)
alejandro-colomar commented 6 months ago

v2c changes:

$ git range-diff alx/master..gh/STRFTIME shadow/master..STRFTIME 
1:  17a0e3b8 = 1:  f262a83f lib/string/strftime.[ch]: STRFTIME(): Add macro
2:  11d9031f ! 2:  be744b6d lib/, src/: Use STRFTIME() instead of its pattern
    @@ src/chage.c
      #include "string/strtcpy.h"
      #ifdef WITH_TCB
      #include "tcbfuncs.h"
    -@@ src/chage.c: static void print_date (time_t date)
    +@@ src/chage.c: print_day_as_date(long day)
        if (NULL == tp) {
                (void) printf ("time_t: %lu\n", (unsigned long)date);
        } else {
3:  fab56737 = 3:  1f1d0cdd src/login.c: Use localtime_r(3) instead of localtime(3)
alejandro-colomar commented 6 months ago

v2d changes:

$ git range-diff gh/master..gh/STRFTIME  alx/master..STRFTIME 
1:  f262a83f = 1:  d33dbc21 lib/string/strftime.[ch]: STRFTIME(): Add macro
2:  be744b6d = 2:  ee148585 lib/, src/: Use STRFTIME() instead of its pattern
3:  1f1d0cdd = 3:  f4833fc8 src/login.c: Use localtime_r(3) instead of localtime(3)
alejandro-colomar commented 6 months ago

v2e changes:

$ git range-diff 89c4da43..gh/STRFTIME alx/master..STRFTIME 
1:  d33dbc21 = 1:  503c432e lib/string/strftime.[ch]: STRFTIME(): Add macro
2:  ee148585 = 2:  4975a455 lib/, src/: Use STRFTIME() instead of its pattern
3:  f4833fc8 = 3:  d1779850 src/login.c: Use localtime_r(3) instead of localtime(3)
alejandro-colomar commented 5 months ago

v3 changes:

$ git range-diff master..gh/STRFTIME alx/master..STRFTIME 
1:  503c432e = 1:  b896ffef lib/string/strftime.[ch]: STRFTIME(): Add macro
2:  4975a455 ! 2:  72550a34 lib/, src/: Use STRFTIME() instead of its pattern
    @@ src/chage.c
      #include "string/sprintf.h"
     +#include "string/strftime.h"
      #include "string/strtcpy.h"
    - #ifdef WITH_TCB
    - #include "tcbfuncs.h"
    + #include "time/day_to_str.h"
    + /*@-exitarg@*/
     @@ src/chage.c: print_day_as_date(long day)
    -   if (NULL == tp) {
    -           (void) printf ("time_t: %lu\n", (unsigned long)date);
    -   } else {
    --          (void) strftime (buf, sizeof buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", tp);
    -+          STRFTIME(buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", tp);
    -           (void) puts (buf);
    +           return;
        }
    + 
    +-  (void) strftime (buf, sizeof buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", &tm);
    ++  STRFTIME(buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", &tm);
    +   (void) puts (buf);
      }
    + 

      ## src/faillog.c ##
     @@
3:  d1779850 = 3:  579a2bef src/login.c: Use localtime_r(3) instead of localtime(3)
alejandro-colomar commented 5 months ago

v3b changes:

$ git range-diff gh/master..gh/STRFTIME shadow/master..STRFTIME 
1:  b896ffef = 1:  36490700 lib/string/strftime.[ch]: STRFTIME(): Add macro
2:  72550a34 = 2:  48e04657 lib/, src/: Use STRFTIME() instead of its pattern
3:  579a2bef = 3:  f08a38a5 src/login.c: Use localtime_r(3) instead of localtime(3)
alejandro-colomar commented 5 months ago

Thanks, @hallyn!

$ git range-diff gh/master..gh/STRFTIME shadow/master..STRFTIME 
1:  36490700 ! 1:  3ece355c lib/string/strftime.[ch]: STRFTIME(): Add macro
    @@ Commit message
         This macro makes sure that the first argument is an array, and
         calculates its size.

    +    Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## lib/Makefile.am ##
2:  48e04657 ! 2:  ae2634fa lib/, src/: Use STRFTIME() instead of its pattern
    @@ Metadata
      ## Commit message ##
         lib/, src/: Use STRFTIME() instead of its pattern

    +    Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## lib/failure.c ##
3:  f08a38a5 ! 3:  09043386 src/login.c: Use localtime_r(3) instead of localtime(3)
    @@ Commit message
         This silences a CodeQL warning.  We don't care about reentrancy, but
         after this patch we don't need to break a long line, so that's a win.

    +    Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com>
         Signed-off-by: Alejandro Colomar <alx@kernel.org>

      ## src/login.c ##