Fix function prototypes

This resolves Bug 2434

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/2/head r14.0.3
Slávek Banko 9 years ago
parent bb1740cd73
commit d057953830

@ -42,14 +42,8 @@
# define OPT_SHADOW "" # define OPT_SHADOW ""
#endif #endif
/* The functions are actually macros so that we can pick up the file and line #include "messages.h"
number information for debugging error messages without the user having to #include "xmalloc.h"
pass those in every time. */
#define xcalloc(n, size) x_calloc((n), (size), __FILE__, __LINE__)
#define xmalloc(size) x_malloc((size), __FILE__, __LINE__)
#define xrealloc(p, size) x_realloc((p), (size), __FILE__, __LINE__)
#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
#include <security/pam_appl.h> #include <security/pam_appl.h>

@ -43,14 +43,8 @@
# define OPT_SHADOW "" # define OPT_SHADOW ""
#endif #endif
/* The functions are actually macros so that we can pick up the file and line #include "messages.h"
number information for debugging error messages without the user having to #include "xmalloc.h"
pass those in every time. */
#define xcalloc(n, size) x_calloc((n), (size), __FILE__, __LINE__)
#define xmalloc(size) x_malloc((size), __FILE__, __LINE__)
#define xrealloc(p, size) x_realloc((p), (size), __FILE__, __LINE__)
#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
#include <security/pam_appl.h> #include <security/pam_appl.h>

@ -82,14 +82,7 @@
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
/* The functions are actually macros so that we can pick up the file and line #include "xmalloc.h"
number information for debugging error messages without the user having to
pass those in every time. */
#define xcalloc(n, size) x_calloc((n), (size), __FILE__, __LINE__)
#define xmalloc(size) x_malloc((size), __FILE__, __LINE__)
#define xrealloc(p, size) x_realloc((p), (size), __FILE__, __LINE__)
#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
/* These are the currently-supported types of traces. */ /* These are the currently-supported types of traces. */
enum message_trace { enum message_trace {

@ -0,0 +1,18 @@
/* $Id: messages.h $
*
* Message and error reporting (possibly fatal).
*
*/
#if !defined(_MESSAGES_H)
#define _MESSAGES_H
/* The reporting functions. The ones prefaced by "sys" add a colon, a space,
and the results of strerror(errno) to the output and are intended for
reporting failures of system calls. */
extern void die(const char *, ...)
__attribute__((__noreturn__, __format__(printf, 1, 2)));
extern void sysdie(const char *, ...)
__attribute__((__noreturn__, __format__(printf, 1, 2)));
#endif /* _MESSAGES_H */

@ -70,6 +70,8 @@
#include <pwd.h> #include <pwd.h>
#include <grp.h> #include <grp.h>
#include "messages.h"
/* Failure handler takes the function, the size, the file, and the line. */ /* Failure handler takes the function, the size, the file, and the line. */
typedef void (*xmalloc_handler_t)(const char *, size_t, const char *, int); typedef void (*xmalloc_handler_t)(const char *, size_t, const char *, int);

@ -0,0 +1,28 @@
/* $Id: xmalloc.h $
*
* malloc routines with failure handling.
*
*/
#if !defined(_XMALLOC_H)
#define _XMALLOC_H
/* The functions are actually macros so that we can pick up the file and line
number information for debugging error messages without the user having to
pass those in every time. */
#define xcalloc(n, size) x_calloc((n), (size), __FILE__, __LINE__)
#define xmalloc(size) x_malloc((size), __FILE__, __LINE__)
#define xrealloc(p, size) x_realloc((p), (size), __FILE__, __LINE__)
#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
/*
* Prototypes of functions
*/
void* x_malloc(size_t size, const char *file, int line);
void* x_calloc(size_t n, size_t size, const char *file, int line);
void* x_realloc(void *p, size_t size, const char *file, int line);
char* x_strdup(const char *s, const char *file, int line);
char* x_strndup(const char *s, size_t size, const char *file, int line);
#endif /* _XMALLOC_H */
Loading…
Cancel
Save