From: Kurt Zeilenga Date: Sun, 6 Jan 2002 01:34:53 +0000 (+0000) Subject: Add SLAP_MALLOC() and friends. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~265 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d218a5ed5c3ed9dc4cc0cf3b2c1c4e467c9478c0;p=openldap Add SLAP_MALLOC() and friends. Intended to be used instead of ch_malloc() and friends. See comment. --- diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 13c932185d..daf702c58f 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -35,14 +35,31 @@ #include "ldap_queue.h" LDAP_BEGIN_DECL - -#define SERVICE_NAME OPENLDAP_PACKAGE "-slapd" -#define SLAPD_ANONYMOUS "cn=anonymous" +/* + * SLAPD Memory allocation macros + * + * Unlike ch_*() routines, these routines do not assert() upon + * allocation error. They are intended to be used instead of + * ch_*() routines where the caller has implemented proper + * checking for and handling of allocation errors. + * + * Patches to convert ch_*() calls to SLAP_*() calls welcomed. + */ +#define SLAP_MALLOC(s) ber_memalloc((s)) +#define SLAP_CALLOC(n,s) ber_memcalloc((n),(s)) +#define SLAP_REALLOC(p,s) ber_memrealloc((p),(s)) +#define SLAP_FREE(p) ber_memfree((p)) +#define SLAP_VFREE(v) ber_memvfree((void**)(v)) +#define SLAP_STRDUP(s) ber_strdup((s)) +#define SLAP_STRNDUP(s,l) ber_strndup((s),(l)) #ifdef f_next #undef f_next /* name conflict between sys/file.h on SCO and struct filter */ #endif +#define SERVICE_NAME OPENLDAP_PACKAGE "-slapd" +#define SLAPD_ANONYMOUS "cn=anonymous" + /* LDAPMod.mod_op value ===> Must be kept in sync with ldap.h! * * This is a value used internally by the backends. It is needed to allow