lib/attr.h, lib/, src/: Move attributes to new header file

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2023-11-28 02:27:08 +01:00
committed by Serge Hallyn
parent 5abe0811b8
commit 44b8f7b3ef
26 changed files with 56 additions and 17 deletions

View File

@@ -28,6 +28,7 @@ libshadow_la_SOURCES = \
agetpass.h \
alloc.c \
alloc.h \
attr.h \
audit_help.c \
basename.c \
bit.c \

View File

@@ -10,6 +10,7 @@
#include <config.h>
#include "attr.h"
#include "defines.h"

View File

@@ -17,6 +17,7 @@
#include <stdint.h>
#include <stdlib.h>
#include "attr.h"
#include "defines.h"

25
lib/attr.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef SHADOW_INCLUDE_LIB_ATTR_H_
#define SHADOW_INCLUDE_LIB_ATTR_H_
#include "config.h"
#if defined(__GNUC__)
# define unused __attribute__((unused))
# define NORETURN __attribute__((__noreturn__))
# define format_attr(type, fmt, va) __attribute__((format(type, fmt, va)))
#else
# define unused
# define NORETURN
# define format_attr(type, fmt, va)
#endif
#if (__GNUC__ >= 11) && !defined(__clang__)
# define ATTR_MALLOC(deallocator) [[gnu::malloc(deallocator)]]
#else
# define ATTR_MALLOC(deallocator)
#endif
#endif // include guard

View File

@@ -21,6 +21,8 @@
#include <libaudit.h>
#include <errno.h>
#include <stdio.h>
#include "attr.h"
#include "prototypes.h"
#include "shadowlog.h"
int audit_fd;

View File

@@ -9,6 +9,7 @@
#include <assert.h>
#include <stdio.h>
#include "attr.h"
#include "defines.h"
#include "groupio.h"
#include "sgroupio.h"

View File

@@ -9,6 +9,7 @@
#include <assert.h>
#include <stdio.h>
#include "attr.h"
#include "defines.h"
#include "pwio.h"
#include "shadowio.h"

View File

@@ -19,6 +19,7 @@
#include <stdio.h>
#include "alloc.h"
#include "attr.h"
#include "prototypes.h"
#include "defines.h"
#ifdef WITH_SELINUX

View File

@@ -203,26 +203,9 @@
#include <libaudit.h>
#endif
/* To be used for verified unused parameters */
#if defined(__GNUC__)
# define unused __attribute__((unused))
# define NORETURN __attribute__((__noreturn__))
# define format_attr(type, index, check) __attribute__((format (type, index, check)))
#else
# define unused
# define NORETURN
# define format_attr(type, index, check)
#endif
/* Maximum length of passwd entry */
#define PASSWD_ENTRY_MAX_LENGTH 32768
#if (__GNUC__ >= 11) && !defined(__clang__)
# define ATTR_MALLOC(deallocator) [[gnu::malloc(deallocator)]]
#else
# define ATTR_MALLOC(deallocator)
#endif
#ifdef HAVE_SECURE_GETENV
# define shadow_getenv(name) secure_getenv(name)
# else

View File

@@ -28,6 +28,7 @@
#include <ctype.h>
#include <time.h>
#include "attr.h"
#include "getdate.h"
#include <string.h>

View File

@@ -8,6 +8,7 @@
#ident "$Id$"
#include "attr.h"
#include "defines.h"
#include "prototypes.h"

View File

@@ -16,6 +16,7 @@
#include <signal.h>
#include "alloc.h"
#include "attr.h"
#include "memzero.h"
#include "prototypes.h"
#include "defines.h"

View File

@@ -16,6 +16,7 @@
#include <stdio.h>
#include "alloc.h"
#include "attr.h"
#include "memzero.h"
#include "prototypes.h"
#include "defines.h"

View File

@@ -18,6 +18,7 @@
#include <security/pam_appl.h>
#include "alloc.h"
#include "attr.h"
#include "prototypes.h"
#include "shadowlog.h"

View File

@@ -31,6 +31,7 @@
#include <lastlog.h>
#endif /* ENABLE_LASTLOG */
#include "attr.h"
#include "defines.h"
#include "commonio.h"

View File

@@ -13,6 +13,8 @@
#include <stdio.h>
#include <shadow.h>
#include "attr.h"
#include "prototypes.h"
#include "defines.h"
#include "pwauth.h"

View File

@@ -16,8 +16,12 @@
#endif
#include <stdio.h>
#include <stdarg.h>
#include <selinux/selinux.h>
#include <semanage/semanage.h>
#include "attr.h"
#include "prototypes.h"
#include "shadowlog_internal.h"

View File

@@ -14,6 +14,7 @@
#include <stddef.h>
#include <stdio.h>
#include "attr.h"
#include "defines.h"

View File

@@ -17,6 +17,7 @@
#include <stddef.h>
#include <stdio.h>
#include "attr.h"
#include "defines.h"

View File

@@ -16,6 +16,8 @@
#include <stdio.h>
#include <sys/types.h>
#include <getopt.h>
#include "attr.h"
#include "defines.h"
#include "prototypes.h"
/*@-exitarg@*/

View File

@@ -22,6 +22,7 @@
#include "agetpass.h"
#include "alloc.h"
#include "attr.h"
#include "defines.h"
#include "groupio.h"
#include "memzero.h"

View File

@@ -26,6 +26,7 @@
#include <unistd.h>
#include <getopt.h>
#include "attr.h"
#include "nscd.h"
#include "sssd.h"
#include "prototypes.h"

View File

@@ -24,6 +24,8 @@
#include <unistd.h>
#include <grp.h>
#include <getopt.h>
#include "attr.h"
#include "nscd.h"
#include "sssd.h"
#include "prototypes.h"

View File

@@ -26,6 +26,7 @@
#include <assert.h>
#include "alloc.h"
#include "attr.h"
#include "defines.h"
#include "faillog.h"
#include "failure.h"

View File

@@ -47,6 +47,7 @@
#endif /* !USE_PAM */
#include "alloc.h"
#include "attr.h"
#include "prototypes.h"
#include "defines.h"
#include "pwauth.h"

View File

@@ -18,6 +18,7 @@
#include <sys/ioctl.h>
#include "agetpass.h"
#include "attr.h"
#include "defines.h"
#include "getdef.h"
#include "memzero.h"