summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2006-11-14 14:41:45 +0000
committerArthur de Jong <arthur@arthurdejong.org>2006-11-14 14:41:45 +0000
commit924e65df508f8c7c69d204d4c7dceeee28a6b710 (patch)
treef85484547413cc1bd35d4a681c5926240425bfd9
parent96967f6d0d79d20de09033c1e63c24c772a6c063 (diff)
add xxmalloc() macro to simply allocate a structure of a certain type
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@89 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--xmalloc.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/xmalloc.h b/xmalloc.h
index d361a7b..a4a6238 100644
--- a/xmalloc.h
+++ b/xmalloc.h
@@ -19,20 +19,18 @@
MA 02110-1301 USA
*/
-
#ifndef _XMALLOC_H
#define _XMALLOC_H 1
-
#include <stdlib.h>
-
/* malloc wrapper */
void *xmalloc(size_t size);
+/* allocate size for a specific type */
+#define xxmalloc(type,count) (type *)xmalloc(sizeof(type)*(count))
/* strdup wrapper */
char *xstrdup(const char *s);
-
#endif /* not _XMALLOC_H */