HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
35 Functions for managing parameter block
This chapter contains reference information on parameter block routines.
Table 35-1 Parameter block routines
DescriptionFunction
Frees a pblock from memory.
“slapi_pblock_destroy()”
Gets the value from a pblock.
“slapi_pblock_get()”
Initializes an existing parameter block so that it can be reused.“slapi_pblock_init()”
Creates a new pblock.
“slapi_pblock_new()”
Sets the value of a pblock.
“slapi_pblock_set()”
35.1 slapi_pblock_destroy()
Frees the specified parameter block from memory.
Syntax
#include "slapi-plugin.h"
void slapi_pblock_destroy( Slapi_PBlock *pb );
Parameters This function takes the following parameter:
Parameter block that you want to free.
pb
Memory concerns The parameter block that you wish to free must have been created using
“slapi_pblock_new()”. Use of this function with pblock allocated on the stack (for example,
Slapi_PBlock pb;) or using another memory allocator is not supported and may lead to
memory errors and memory leaks. For example:
Slapi_PBlock *pb = malloc(sizeof(Slapi_PBlock));
After calling this function, you should set the pblock pointer to NULL to avoid reusing freed
memory in your function context, as in the following:
slapi_pblock_destroy(pb); pb = NULL;
If you reuse the pointer in this way, it makes it easier to identify a segmentation fault, rather
than using some difficult method to detect memory leaks or other abnormal behavior.
It is safe to call this function with a NULL pointer. For example:
Slapi_PBlock *pb = NULL; slapi_pblock_destroy(pb);
This saves the trouble of checking for NULL before calling slapi_pblock_destroy().
See also “slapi_pblock_new()”
35.2 slapi_pblock_get()
Gets the value of a name-value pair from a parameter block.
Syntax
#include "slapi-plugin.h"
int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
35.1 slapi_pblock_destroy() 287