HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
“slapi_ch_free()”
“slapi_ch_calloc()”
slapi_ch_strdup()
23.10 slapi_ch_smprintf()
Creates, writes to, and returns a given string.
Syntax
#include "slapi-plugin.h"
char *string = slapi_ch_smprintf (format, *arg, ...);
Parameters This function takes the following parameter:
String that is printed.
string
A printf-style format string.format
Arguments to pass for the string.
arg
Returns
0 If the string is successfully printed and returned.
1 If an error occurs.
This function the specified string, write to it using the specified formats and arguments, and
returns the string. If space cannot be allocated, for example, no more virtual memory exists, the
slapd program terminates.
Memory concerns This function terminates the slapd server with an "out of memory" error
message if memory cannot be allocated. The returned string should be freed by calling
“slapi_ch_free()” to avoid memory leaks.
See also
“slapi_ch_free()”
“slapi_ch_calloc()”
slapi_ch_malloc()
slapi_ch_realloc()
23.11 slapi_ch_strdup()
Makes a copy of an existing string.
Syntax
#include "slapi-plugin.h"
char * slapi_ch_strdup( const char *s );
Parameters This function takes the following parameter:
Pointer to the string you want to copy.
s
Returns This function returns a pointer to a copy of the string. If space cannot be allocated, for
example, no more virtual memory exists, the slapd program terminates.
Memory concerns This function terminates the slapd server with an "out of memory" error
message if memory cannot be allocated.
The returned pointer should be freed by calling “slapi_ch_free()”.
See also
“slapi_ch_free()”
“slapi_ch_calloc()”
23.10 slapi_ch_smprintf() 209