summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-11-20 06:38:09 +0000
committerMartin Pool <mbp@samba.org>2001-11-20 06:38:09 +0000
commit5b1fb34731b3bc8331f99ae4e193b7c078ee9f7a (patch)
tree095766014748cff94fb44348ad565ddab0bfd542 /source3/lib
parent4950e6feb69ed73663faf2977520e90d97bbce03 (diff)
downloadsamba-5b1fb34731b3bc8331f99ae4e193b7c078ee9f7a.tar.gz
samba-5b1fb34731b3bc8331f99ae4e193b7c078ee9f7a.tar.bz2
samba-5b1fb34731b3bc8331f99ae4e193b7c078ee9f7a.zip
Rename xmalloc, xmemdup, xstrdup to smb_$1 to avoid conflicts with the
versions defined by libreadline on SCO (!). (This used to be commit 32480d7aff21ce1c14991e242aaf8a4e14ec6f2a)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index ea39d8a05b..dc948a406b 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1698,41 +1698,42 @@ int smb_mkstemp(char *template)
#endif
}
-/*****************************************************************
+
+/**
malloc that aborts with smb_panic on fail or zero size.
- *****************************************************************/
+**/
-void *xmalloc(size_t size)
+void *smb_xmalloc(size_t size)
{
void *p;
if (size == 0)
- smb_panic("xmalloc: called with zero size.\n");
+ smb_panic("smb_xmalloc: called with zero size.\n");
if ((p = malloc(size)) == NULL)
- smb_panic("xmalloc: malloc fail.\n");
+ smb_panic("smb_xmalloc: malloc fail.\n");
return p;
}
-/*****************************************************************
+/**
Memdup with smb_panic on fail.
- *****************************************************************/
+**/
-void *xmemdup(const void *p, size_t size)
+void *smb_xmemdup(const void *p, size_t size)
{
void *p2;
- p2 = xmalloc(size);
+ p2 = smb_xmalloc(size);
memcpy(p2, p, size);
return p2;
}
-/*****************************************************************
+/**
strdup that aborts on malloc fail.
- *****************************************************************/
+**/
-char *xstrdup(const char *s)
+char *smb_xstrdup(const char *s)
{
char *s1 = strdup(s);
if (!s1)
- smb_panic("xstrdup: malloc fail\n");
+ smb_panic("smb_xstrdup: malloc fail\n");
return s1;
}
@@ -2021,7 +2022,7 @@ DATA_BLOB data_blob(const void *p, size_t length)
return ret;
}
- ret.data = xmemdup(p, length);
+ ret.data = smb_xmemdup(p, length);
ret.length = length;
return ret;
}