From: Alejandro Colomar Date: Mon, 29 Jan 2024 14:11:04 +0000 (+0100) Subject: lib/, src/, po/: date_to_str(): Move function to header, and make inline X-Git-Tag: 4.15.1~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be05c62bd7e146a54e6b54b1dc10c1e145e48381;p=thirdparty%2Fshadow.git lib/, src/, po/: date_to_str(): Move function to header, and make inline BTW, there's no translatable string in there. Signed-off-by: Alejandro Colomar --- diff --git a/lib/Makefile.am b/lib/Makefile.am index 86c6be73d..58d9c1427 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -53,7 +53,6 @@ libshadow_la_SOURCES = \ console.c \ copydir.c \ csrand.c \ - date_to_str.c \ defines.h \ encrypt.c \ env.c \ @@ -159,6 +158,8 @@ libshadow_la_SOURCES = \ subordinateio.h \ subordinateio.c \ sulog.c \ + time/day_to_str.c \ + time/day_to_str.h \ ttytype.c \ tz.c \ ulimit.c \ diff --git a/lib/prototypes.h b/lib/prototypes.h index ff4f7f996..0838884ba 100644 --- a/lib/prototypes.h +++ b/lib/prototypes.h @@ -108,9 +108,6 @@ extern int copy_tree (const char *src_root, const char *dst_root, uid_t old_uid, uid_t new_uid, gid_t old_gid, gid_t new_gid); -/* date_to_str.c */ -extern void date_to_str (size_t size, char buf[size], long date); - /* encrypt.c */ extern /*@exposed@*//*@null@*/char *pw_encrypt (const char *, const char *); diff --git a/lib/time/day_to_str.c b/lib/time/day_to_str.c new file mode 100644 index 000000000..4acfe907d --- /dev/null +++ b/lib/time/day_to_str.c @@ -0,0 +1,10 @@ +// SPDX-FileCopyrightText: 2021-2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#include + +#include "time/day_to_str.h" + + +extern inline void date_to_str(size_t size, char buf[size], long date); diff --git a/lib/date_to_str.c b/lib/time/day_to_str.h similarity index 73% rename from lib/date_to_str.c rename to lib/time/day_to_str.h index cbba0e464..65601c96d 100644 --- a/lib/date_to_str.c +++ b/lib/time/day_to_str.h @@ -4,18 +4,21 @@ */ +#ifndef SHADOW_INCLUDE_LIB_TIME_DAY_TO_STR_H_ +#define SHADOW_INCLUDE_LIB_TIME_DAY_TO_STR_H_ + + #include -#include #include -#ident "$Id$" - #include "string/strtcpy.h" -#include "prototypes.h" -void +inline void date_to_str(size_t size, char buf[size], long date); + + +inline void date_to_str(size_t size, char buf[size], long date) { time_t t; @@ -36,3 +39,6 @@ date_to_str(size_t size, char buf[size], long date) if (strftime(buf, size, "%Y-%m-%d", tm) == 0) (void) strtcpy(buf, "future", size); } + + +#endif // include guard diff --git a/po/POTFILES.in b/po/POTFILES.in index d49a54606..ce610d1ab 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -13,7 +13,6 @@ lib/cleanup_user.c lib/commonio.c lib/console.c lib/copydir.c -lib/date_to_str.c lib/encrypt.c lib/env.c lib/failure.c diff --git a/src/chage.c b/src/chage.c index c29ef99e5..5788a190a 100644 --- a/src/chage.c +++ b/src/chage.c @@ -27,19 +27,21 @@ #include #include "alloc.h" -#include "prototypes.h" #include "defines.h" #include "memzero.h" +#include "prototypes.h" #include "pwio.h" #include "shadowio.h" #include "shadowlog.h" #include "string/sprintf.h" #include "string/strtcpy.h" +#include "time/day_to_str.h" +/*@-exitarg@*/ +#include "exitcodes.h" + #ifdef WITH_TCB #include "tcbfuncs.h" #endif -/*@-exitarg@*/ -#include "exitcodes.h" /* diff --git a/src/passwd.c b/src/passwd.c index 5a4219371..1b797892a 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -33,6 +33,8 @@ #include "shadowio.h" #include "shadowlog.h" #include "string/strtcpy.h" +#include "time/day_to_str.h" + /* * exit status values diff --git a/src/usermod.c b/src/usermod.c index 7f0393b65..63fb996d1 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -59,6 +59,7 @@ #endif #include "shadowlog.h" #include "string/sprintf.h" +#include "time/day_to_str.h" /*