Sockbuf * ber_sockbuf_alloc( void ) { Sockbuf *sb; sb = LBER_CALLOC( 1, sizeof( Sockbuf ) ); if( sb == NULL ) return NULL; ber_int_sb_init( sb ); return sb; }
Sockbuf * ber_sockbuf_alloc( void ) { Sockbuf *sb; ber_int_options.lbo_valid = LBER_INITIALIZED; sb = LBER_CALLOC( 1, sizeof( Sockbuf ) ); if( sb == NULL ) return NULL; ber_int_sb_init( sb ); return sb; }
BerElement * ber_alloc_t( int options ) { BerElement *ber; ber = (BerElement *) LBER_CALLOC( 1, sizeof(BerElement) ); if ( ber == NULL ) { return NULL; } ber->ber_valid = LBER_VALID_BERELEMENT; ber->ber_tag = LBER_DEFAULT; ber->ber_options = options; ber->ber_debug = ber_int_debug; assert( LBER_VALID( ber ) ); return ber; }
int ldap_create_sort_keylist ( LDAPSortKey ***sortKeyList, char *keyString ) { int numKeys, rc, i; char *nextKey; LDAPSortKey **keyList = NULL; assert( sortKeyList != NULL ); assert( keyString != NULL ); *sortKeyList = NULL; /* Determine the number of sort keys so we can allocate memory. */ if (( numKeys = countKeys(keyString)) == 0) { return LDAP_PARAM_ERROR; } /* Allocate the array of pointers. Initialize to NULL. */ keyList=(LDAPSortKey**)LBER_CALLOC(numKeys+1, sizeof(LDAPSortKey*)); if ( keyList == NULL) return LDAP_NO_MEMORY; /* For each sort key in the string, create an LDAPSortKey structure and add it to the list. */ nextKey = keyString; /* Points to the next key in the string */ for (i=0; i < numKeys; i++) { rc = readNextKey(&nextKey, &keyList[i]); if (rc != LDAP_SUCCESS) { ldap_free_sort_keylist(keyList); return rc; } } *sortKeyList = keyList; return LDAP_SUCCESS; }