diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2006-11-14 14:41:45 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2006-11-14 14:41:45 +0000 |
commit | 924e65df508f8c7c69d204d4c7dceeee28a6b710 (patch) | |
tree | f85484547413cc1bd35d4a681c5926240425bfd9 | |
parent | 96967f6d0d79d20de09033c1e63c24c772a6c063 (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.h | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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 */ |