aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd-compat
diff options
context:
space:
mode:
authorCharles Longeau <github@chl.be>2012-08-09 09:02:05 +0200
committerCharles Longeau <github@chl.be>2012-08-09 23:52:52 +0200
commit07c419ac97c56ded32733af98f941aebc249a40d (patch)
treee400090b882b226874c728389c0379c48bbc7f08 /openbsd-compat
parentadd missing include (diff)
downloadOpenSMTPD-07c419ac97c56ded32733af98f941aebc249a40d.tar.xz
OpenSMTPD-07c419ac97c56ded32733af98f941aebc249a40d.zip
prefix x{m,c,re}alloc(), xstrdup() and xfree() coming from portable OpenSSH with __ to avoid conflicts with the new one which will come from smtpd
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/entropy.c2
-rw-r--r--openbsd-compat/fgetln.c4
-rw-r--r--openbsd-compat/xmalloc.c12
-rw-r--r--openbsd-compat/xmalloc.h10
4 files changed, 14 insertions, 14 deletions
diff --git a/openbsd-compat/entropy.c b/openbsd-compat/entropy.c
index c46c3205..2d4e1518 100644
--- a/openbsd-compat/entropy.c
+++ b/openbsd-compat/entropy.c
@@ -45,7 +45,7 @@
//#include "ssh.h"
//#include "misc.h"
-#include "xmalloc.h"
+//#include "xmalloc.h"
//#include "atomicio.h"
//#include "pathnames.h"
//#include "log.h"
diff --git a/openbsd-compat/fgetln.c b/openbsd-compat/fgetln.c
index 1c256ea3..4a7d6461 100644
--- a/openbsd-compat/fgetln.c
+++ b/openbsd-compat/fgetln.c
@@ -45,13 +45,13 @@ fgetln(stream, len)
if (buflen == 0) {
buflen = 512;
- buffer = xmalloc(buflen+1);
+ buffer = __xmalloc(buflen+1);
}
if (fgets(buffer, buflen+1, stream) == NULL)
return NULL;
*len = strlen(buffer);
while (*len == buflen && buffer[*len-1] != '\n') {
- buffer = xrealloc(buffer, 1, 2*buflen + 1);
+ buffer = __xrealloc(buffer, 1, 2*buflen + 1);
if (fgets(buffer + buflen, buflen + 1, stream) == NULL)
return NULL;
*len += strlen(buffer + buflen);
diff --git a/openbsd-compat/xmalloc.c b/openbsd-compat/xmalloc.c
index 967b2604..d4f18727 100644
--- a/openbsd-compat/xmalloc.c
+++ b/openbsd-compat/xmalloc.c
@@ -26,7 +26,7 @@
#include "xmalloc.h"
void *
-xmalloc(size_t size)
+__xmalloc(size_t size)
{
void *ptr;
@@ -39,7 +39,7 @@ xmalloc(size_t size)
}
void *
-xcalloc(size_t nmemb, size_t size)
+__xcalloc(size_t nmemb, size_t size)
{
void *ptr;
@@ -55,7 +55,7 @@ xcalloc(size_t nmemb, size_t size)
}
void *
-xrealloc(void *ptr, size_t nmemb, size_t size)
+__xrealloc(void *ptr, size_t nmemb, size_t size)
{
void *new_ptr;
size_t new_size = nmemb * size;
@@ -75,7 +75,7 @@ xrealloc(void *ptr, size_t nmemb, size_t size)
}
void
-xfree(void *ptr)
+__xfree(void *ptr)
{
if (ptr == NULL)
fatal("xfree: NULL pointer given as argument");
@@ -83,13 +83,13 @@ xfree(void *ptr)
}
char *
-xstrdup(const char *str)
+__xstrdup(const char *str)
{
size_t len;
char *cp;
len = strlen(str) + 1;
- cp = xmalloc(len);
+ cp = __xmalloc(len);
strlcpy(cp, str, len);
return cp;
}
diff --git a/openbsd-compat/xmalloc.h b/openbsd-compat/xmalloc.h
index 157a5106..da1c4cbb 100644
--- a/openbsd-compat/xmalloc.h
+++ b/openbsd-compat/xmalloc.h
@@ -19,11 +19,11 @@
#ifndef XMALLOC_H
#define XMALLOC_H
-void *xmalloc(size_t);
-void *xcalloc(size_t, size_t);
-void *xrealloc(void *, size_t, size_t);
-void xfree(void *);
-char *xstrdup(const char *);
+void *__xmalloc(size_t);
+void *__xcalloc(size_t, size_t);
+void *__xrealloc(void *, size_t, size_t);
+void __xfree(void *);
+char *__xstrdup(const char *);
int xasprintf(char **, const char *, ...)
__attribute__((__format__ (printf, 2, 3)))
__attribute__((__nonnull__ (2)));