24.14. slapi_entry_attr_get_charray()
This function is very similar to slapi_entry_attr_get_charptr(), except that it returns a char** array for multi-valued attributes. The array and all values are copies. Even if the attribute values are not strings, they will still be null terminated so that they can be used safely in a string context. If there are no values, NULL will be returned. Because the array is NULL terminated, the usage should be similar to the sample shown below:
char **ary = slapi_entry_attr_get_charray(e, someattr);
int ii;
for (ii = 0; ary && ary[ii]; ++ii) {
char *strval = ary[ii];
...
}
slapi_ch_array_free(ary);
#include "slapi-plugin.h" char ** slapi_entry_attr_get_charray( const Slapi_Entry* e, const char *type);
This function takes the following parameters:
|
e
| Entry from which you want to get the values. |
|
type
| Attribute type from which you want to get the values. |
This function returns one of the following values:
- A copy of all the values of the attribute.
NULLif the entry does not contain the attribute or if the attribute has no values.
When you are done working with the values, free them from memory by calling the slapi_ch_array_free() function.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.