]> git.ipfire.org Git - thirdparty/shadow.git/commit
Have a single definition of date_to_str() 467/head
authorAlejandro Colomar <alx.manpages@gmail.com>
Wed, 22 Dec 2021 14:32:17 +0000 (15:32 +0100)
committerAlejandro Colomar <alx.manpages@gmail.com>
Sun, 26 Dec 2021 17:55:39 +0000 (18:55 +0100)
commit355ad6a9e089717be726f956e6fa54fb07425a94
treec73a109e2d45c0c757babce5d5d3061922f16a98
parentb8c67c320cd015b03a27154efa75b1dbe907886d
Have a single definition of date_to_str()

PARAMETERS:

According to the C2x charter, I reordered the parameters 'size'
and 'buf' from previously existing date_to_str() definitions.

C2x charter:
> 15. Application Programming Interfaces (APIs) should be
> self-documenting when possible.  In particular, the order of
> parameters in function declarations should be arranged such that
> the size of an array appears before the array.  The purpose is to
> allow Variable-Length Array (VLA) notation to be used.  This not
> only makes the code's purpose clearer to human readers, but also
> makes static analysis easier.  Any new APIs added to the Standard
> should take this into consideration.

I used 'long' for the date parameter, as some uses of the function
need to pass a negative value meaning "never".

FUNCTION BODY:

I didn't check '#ifdef HAVE_STRFTIME', which old definitions did,
since strftime(3) is guaranteed by the C89 standard, and all of
the conversion specifiers that we use are also specified by that
standard, so we don't need any extensions at all.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
lib/prototypes.h
libmisc/Makefile.am
libmisc/date_to_str.c [new file with mode: 0644]
po/POTFILES.in
src/chage.c
src/passwd.c
src/usermod.c