summaryrefslogtreecommitdiff
path: root/lib/defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/defines.h')
-rw-r--r--lib/defines.h93
1 files changed, 22 insertions, 71 deletions
diff --git a/lib/defines.h b/lib/defines.h
index fc1521cb..ee33aa0d 100644
--- a/lib/defines.h
+++ b/lib/defines.h
@@ -22,8 +22,6 @@ typedef unsigned char _Bool;
# define __bool_true_false_are_defined 1
#endif
-#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
-
/* Take care of NLS matters. */
#ifdef S_SPLINT_S
extern char *setlocale(int categories, const char *locale);
@@ -61,16 +59,8 @@ extern char * textdomain (const char * domainname);
#endif
#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#else /* not STDC_HEADERS */
-# ifndef HAVE_STRCHR
-# define strchr index
-# define strrchr rindex
-# endif
-char *strchr (), *strrchr (), *strtok ();
-#endif /* not STDC_HEADERS */
+#include <stdlib.h>
+#include <string.h>
#if HAVE_ERRNO_H
# include <errno.h>
@@ -78,15 +68,7 @@ char *strchr (), *strrchr (), *strtok ();
#include <sys/stat.h>
#include <sys/types.h>
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
+#include <sys/wait.h>
#if HAVE_UNISTD_H
# include <unistd.h>
@@ -100,35 +82,26 @@ char *strchr (), *strrchr (), *strtok ();
# include <crypt.h>
#endif
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else /* not TIME_WITH_SYS_TIME */
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif /* not TIME_WITH_SYS_TIME */
+#include <sys/time.h>
+#include <time.h>
+
+#ifdef HAVE_MEMSET_S
+# define memzero(ptr, size) memset_s((ptr), 0, (size))
+#elif defined HAVE_EXPLICIT_BZERO /* !HAVE_MEMSET_S */
+# define memzero(ptr, size) explicit_bzero((ptr), (size))
+#else /* !HAVE_MEMSET_S && HAVE_EXPLICIT_BZERO */
+static inline void memzero(void *ptr, size_t size)
+{
+ volatile unsigned char * volatile p = ptr;
+ while (size--) {
+ *p++ = '\0';
+ }
+}
+#endif /* !HAVE_MEMSET_S && !HAVE_EXPLICIT_BZERO */
-#define memzero(ptr, size) memset((void *)(ptr), 0, (size))
#define strzero(s) memzero(s, strlen(s)) /* warning: evaluates twice */
-#ifdef HAVE_DIRENT_H /* DIR_SYSV */
-# include <dirent.h>
-# define DIRECT dirent
-#else
-# ifdef HAVE_SYS_NDIR_H /* DIR_XENIX */
-# include <sys/ndir.h>
-# endif
-# ifdef HAVE_SYS_DIR_H /* DIR_??? */
-# include <sys/dir.h>
-# endif
-# ifdef HAVE_NDIR_H /* DIR_BSD */
-# include <ndir.h>
-# endif
-# define DIRECT direct
-#endif
+#include <dirent.h>
/*
* Possible cases:
@@ -232,30 +205,6 @@ char *strchr (), *strrchr (), *strtok ();
# define SEEK_END 2
#endif
-#ifdef STAT_MACROS_BROKEN
-# define S_ISDIR(x) ((x) & S_IFMT) == S_IFDIR)
-# define S_ISREG(x) ((x) & S_IFMT) == S_IFREG)
-# ifdef S_IFLNK
-# define S_ISLNK(x) ((x) & S_IFMT) == S_IFLNK)
-# endif
-#endif
-
-#ifndef S_ISLNK
-#define S_ISLNK(x) (0)
-#endif
-
-#if HAVE_LCHOWN
-#define LCHOWN lchown
-#else
-#define LCHOWN chown
-#endif
-
-#if HAVE_LSTAT
-#define LSTAT lstat
-#else
-#define LSTAT stat
-#endif
-
#if HAVE_TERMIOS_H
# include <termios.h>
# define STTY(fd, termio) tcsetattr(fd, TCSANOW, termio)
@@ -355,8 +304,10 @@ extern char *strerror ();
/* To be used for verified unused parameters */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# define unused __attribute__((unused))
+# define format_attr(type, index, check) __attribute__((format (type, index, check)))
#else
# define unused
+# define format_attr(type, index, check)
#endif
/* ! Arguments evaluated twice ! */