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
String that is printed.
format
A printf-style format string.
arg
Arguments to pass for the string.
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, e.g., 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.