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 <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-03-14 16:30:46 -05:00
committed by Serge Hallyn
parent 88760598f0
commit be05c62bd7
8 changed files with 31 additions and 13 deletions
+2 -1
View File
@@ -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 \
-3
View File
@@ -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 *);
+10
View File
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: 2021-2024, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <config.h>
#include "time/day_to_str.h"
extern inline void date_to_str(size_t size, char buf[size], long date);
+11 -5
View File
@@ -4,18 +4,21 @@
*/
#ifndef SHADOW_INCLUDE_LIB_TIME_DAY_TO_STR_H_
#define SHADOW_INCLUDE_LIB_TIME_DAY_TO_STR_H_
#include <config.h>
#include <string.h>
#include <time.h>
#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
-1
View File
@@ -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
+5 -3
View File
@@ -27,19 +27,21 @@
#include <pwd.h>
#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"
/*
+2
View File
@@ -33,6 +33,8 @@
#include "shadowio.h"
#include "shadowlog.h"
#include "string/strtcpy.h"
#include "time/day_to_str.h"
/*
* exit status values
+1
View File
@@ -59,6 +59,7 @@
#endif
#include "shadowlog.h"
#include "string/sprintf.h"
#include "time/day_to_str.h"
/*