]> granicus.if.org Git - sudo/commitdiff
Convert to ANSI C
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 27 Feb 2010 14:26:43 +0000 (09:26 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 27 Feb 2010 14:26:43 +0000 (09:26 -0500)
include/alloc.h
include/compat.h
include/error.h
include/lbuf.h
include/list.h
include/missing.h

index 7442fe8c185b37e5e5ac64b1b30aeb0c11515669..ef9d7c27aa66f724f44a4c104303624ebe67b96c 100644 (file)
@@ -17,8 +17,8 @@
 #ifndef _SUDO_ALLOC_H
 #define _SUDO_ALLOC_H
 
-#ifdef __STDC__
-# include <stdarg.h>
+#include <stdarg.h>
+
 int     easprintf(char **, const char *, ...) __printflike(2, 3);
 int     evasprintf(char **, const char *, va_list) __printflike(2, 0);
 void    efree(void *);
@@ -27,16 +27,5 @@ void *emalloc2(size_t, size_t);
 void   *erealloc(void *, size_t);
 void   *erealloc3(void *, size_t, size_t);
 char   *estrdup(const char *);
-#else
-# include <varargs.h>
-int     easprintf();
-int     evasprintf();
-void    efree();
-void   *emalloc();
-void   *emalloc2();
-void   *erealloc();
-void   *erealloc3();
-char   *estrdup();
-#endif /* __STDC__ */
 
 #endif /* _SUDO_ALLOC_H */
index 808ada3674734ccb6b7b39778ae6f5efd51fa3a7..4641f3b96d4c5011e75e1bd441314c87d9d8d397 100644 (file)
  * Macros that may be missing on some Operating Systems
  */
 
-/* Deal with ANSI stuff reasonably.  */
-#ifndef  __P
-# if defined (__cplusplus) || defined (__STDC__)
-#  define __P(args)            args
-# else
-#  define __P(args)            ()
-# endif
-#endif /* __P */
-
 /* Define away __attribute__ for non-gcc or old gcc */
 #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
 # define __attribute__(x)
  * Simple isblank() macro and function for systems without it.
  */
 #ifndef HAVE_ISBLANK
-int isblank __P((int));
+int isblank(int);
 # define isblank(_x)   ((_x) == ' ' || (_x) == '\t')
 #endif
 
@@ -202,13 +193,13 @@ int isblank __P((int));
 # define sa_flags      sv_flags
 typedef struct sigvec sigaction_t;
 typedef int sigset_t;
-int sigaction __P((int sig, const sigaction_t *act, sigaction_t *oact));
-int sigemptyset __P((sigset_t *));
-int sigfillset __P((sigset_t *));
-int sigaddset __P((sigset_t *, int));
-int sigdelset __P((sigset_t *, int));
-int sigismember __P((sigset_t *, int));
-int sigprocmask __P((int, const sigset_t *, sigset_t *));
+int sigaction(int sig, const sigaction_t *act, sigaction_t *oact);
+int sigemptyset(sigset_t *);
+int sigfillset(sigset_t *);
+int sigaddset(sigset_t *, int);
+int sigdelset(sigset_t *, int);
+int sigismember(sigset_t *, int);
+int sigprocmask(int, const sigset_t *, sigset_t *);
 #endif
 
 /*
@@ -256,7 +247,7 @@ typedef struct sigaction sigaction_t;
 extern const char *__progname;
 #  define getprogname()          (__progname)
 # else
-const char *getprogname __P((void));
+const char *getprogname(void);
 #endif /* HAVE___PROGNAME */
 #endif /* !HAVE_GETPROGNAME */
 
index 5ac3076005e0ac638c9e0cecf21ebc617a526899..563aeb81fa953439db05c8ee0539d371e8c54349 100644 (file)
 #ifndef _SUDO_ERROR_H_
 #define        _SUDO_ERROR_H_
 
-#ifdef __STDC__
-# include <stdarg.h>
+#include <stdarg.h>
+
 void   error(int, const char *, ...) __attribute__((__noreturn__));
 void   errorx(int, const char *, ...) __attribute__((__noreturn__));
 void   warning(const char *, ...);
 void   warningx(const char *, ...);
-#else
-# include <varargs.h>
-void   error() __attribute__((__noreturn__));
-void   errorx() __attribute__((__noreturn__));
-void   warning();
-void   warningx();
-#endif /* __STDC__ */
 
 #endif /* _SUDO_ERROR_H_ */
index fbc9fdc004814c98b6bd059236578b254e662bd7..76ca0f2239e00545eb1abd50cc2d8fc637d0ace0 100644 (file)
@@ -30,10 +30,10 @@ struct lbuf {
     int size;
 };
 
-void lbuf_init         __P((struct lbuf *, char *, int, int));
-void lbuf_destroy      __P((struct lbuf *));
-void lbuf_append       __P((struct lbuf *, ...));
-void lbuf_append_quoted        __P((struct lbuf *, const char *, ...));
-void lbuf_print                __P((struct lbuf *));
+void lbuf_init         (struct lbuf *, char *, int, int);
+void lbuf_destroy      (struct lbuf *);
+void lbuf_append       (struct lbuf *, ...);
+void lbuf_append_quoted        (struct lbuf *, const char *, ...);
+void lbuf_print                (struct lbuf *);
 
 #endif /* _SUDO_LBUF_H */
index 17aab415b1cc19189260f20e73fe6a1c4b546be9..b2842ec652f7996cbf8491fd65ac45f18b312727 100644 (file)
 /*
  * Convenience macro for declaring a list head.
  */
-#ifdef __STDC__
 #define TQ_DECLARE(n)                                  \
 struct n##_list {                                      \
     struct n *first;                                   \
     struct n *last;                                    \
 };
-#else
-#define TQ_DECLARE(n)                                  \
-struct n/**/_list {                                    \
-    struct n *first;                                   \
-    struct n *last;                                    \
-};
-#endif
 
 /*
  * Foreach loops: forward and reverse
@@ -75,9 +67,9 @@ struct n/**/_list {                                   \
 /*
  * Prototypes for list.c
  */
-void *tq_pop           __P((void *));
-void tq_append         __P((void *, void *));
-void list_append       __P((void *, void *));
-void list2tq           __P((void *, void *));
+void *tq_pop           (void *);
+void tq_append         (void *, void *);
+void list_append       (void *, void *);
+void list2tq           (void *, void *);
 
 #endif /* _SUDO_LIST_H */
index 5e38ede2e3ce8681bdf65f8bd6215f4194feb968..7f276d72ba802ec77f6804e59a76ebba43c68632 100644 (file)
@@ -23,62 +23,58 @@ struct timeval;
 struct timespec;
 
 #ifndef HAVE_CLOSEFROM
-void closefrom         __P((int));
+void closefrom(int);
 #endif
 #ifndef HAVE_GETCWD
-char *getcwd           __P((char *, size_t size));
+char *getcwd(char *, size_t size);
 #endif
 #ifndef HAVE_GETLINE
-ssize_t getline                __P((char **, size_t *, FILE *));
+ssize_t getline(char **, size_t *, FILE *);
 #endif
 #ifndef HAVE_UTIMES
-int utimes             __P((const char *, const struct timeval *));
+int utimes(const char *, const struct timeval *);
 #endif
 #ifdef HAVE_FUTIME
-int futimes            __P((int, const struct timeval *));
+int futimes(int, const struct timeval *);
 #endif
 #ifndef HAVE_SNPRINTF
-int snprintf           __P((char *, size_t, const char *, ...))
-                           __printflike(3, 4);
+int snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
 #endif
 #ifndef HAVE_VSNPRINTF
-int vsnprintf          __P((char *, size_t, const char *, va_list))
-                           __printflike(3, 0);
+int vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0);
 #endif
 #ifndef HAVE_ASPRINTF
-int asprintf           __P((char **, const char *, ...))
-                           __printflike(2, 3);
+int asprintf(char **, const char *, ...) __printflike(2, 3);
 #endif
 #ifndef HAVE_VASPRINTF
-int vasprintf          __P((char **, const char *, va_list))
-                           __printflike(2, 0);
+int vasprintf(char **, const char *, va_list) __printflike(2, 0);
 #endif
 #ifndef HAVE_STRCASECMP
-int strcasecmp         __P((const char *, const char *));
+int strcasecmp(const char *, const char *);
 #endif
 #ifndef HAVE_STRLCAT
-size_t strlcat         __P((char *, const char *, size_t));
+size_t strlcat(char *, const char *, size_t);
 #endif
 #ifndef HAVE_STRLCPY
-size_t strlcpy         __P((char *, const char *, size_t));
+size_t strlcpy(char *, const char *, size_t);
 #endif
 #ifndef HAVE_MEMRCHR
-void *memrchr          __P((const void *, int, size_t));
+void *memrchr(const void *, int, size_t);
 #endif
 #ifndef HAVE_MKSTEMP
-int mkstemp            __P((char *));
+int mkstemp(char *);
 #endif
 #ifndef HAVE_NANOSLEEP
-int nanosleep          __P((const struct timespec *, struct timespec *));
+int nanosleep(const struct timespec *, struct timespec *);
 #endif
 #ifndef HAVE_SETENV
-int setenv             __P((const char *, const char *, int));
+int setenv(const char *, const char *, int);
 #endif
 #ifndef HAVE_UNSETENV
-int unsetenv           __P((const char *));
+int unsetenv(const char *);
 #endif
 #ifdef HAVE_SYS_SIGLIST
-char *strsignal                __P((int));
+char *strsignal(int);
 #endif
 
 #endif /* _SUDO_MISSING_H */