Chapter 42. Functions for Handling Values

This chapter contains reference information on value routines.

Table 42.1. Value Routines

Function Description
slapi_value_compare() Compares two values.
slapi_value_dup() Duplicates a value.
slapi_value_free() Frees a Slapi_Value structure from memory.
slapi_value_get_berval() Gets the berval structure of the value.
slapi_value_get_flags() Get flags from a Slapi_Value structure.
slapi_value_get_int() Converts the value of an integer.
slapi_value_get_length() Gets the length of a value.
slapi_value_get_long() Converts a value into a long integer.
slapi_value_get_string() Returns the value as a string.
slapi_value_get_uint() Converts the value into an unsigned integer.
slapi_value_get_ulong() Converts the value into an unsigned long.
slapi_value_init() Initializes a Slapi_Value structure with no values.
slapi_value_init_berval() Initializes a Slapi_Value structure from the berval structure.
slapi_value_init_string() Initializes a Slapi_Value structure from a string.
slapi_value_init_string_passin() Initializes a Slapi_Value structure with a value contained in a string.
slapi_value_new() Allocates a new Slapi_Value structure.
slapi_value_new_berval() Allocates a new Slapi_Value structure from a berval structure.
slapi_value_new_string() Allocates a newSlapi_Value structure from a string.
slapi_value_new_string_passin() Allocates a new Slapi_Value structure and initializes it from a string.
slapi_value_new_value() Allocates a new Slapi_Value from another Slapi_Value structure.
slapi_value_set() Sets the value.
slapi_value_set_berval() Copies the value from a berval structure into a Slapi_Value structure.
slapi_value_set_flags() Sets flags for a Slapi_Value structure.
slapi_value_set_int() Sets the integer value of a Slapi_Value structure.
slapi_value_set_string() Copies a string into the value.
slapi_value_set_string_passin() Sets the value.
slapi_value_set_value() Copies the value of a Slapi_Value structure into another Slapi_Value structure.
slapi_values_set_flags() Sets flags to the array of a Slapi_Value structure.

42.1. slapi_value_compare()

Description

This function compares two Slapi_Values using the matching rule associated to the attribute a to determine if they are equals.

This function replaces the deprecated slapi_attr_value_cmp() function used in previous releases and uses the Slapi_Value attribute values instead of the berval attribute values.
Syntax

#include "slapi-plugin.h"
slapi_value_compare(const Slapi_Attr *a, const Slapi_Value *v1, const Slapi_Value *v2);

Parameters

This function takes the following parameters:

a
A pointer to an attribute used to determine how the two values will be compared.
v1
Pointer to the Slapi_Value structure containing the first value to compare.
v2
Pointer to the Slapi_Value structure containing the second value to compare.
Returns

This function returns one of the following values:

  • 0 if the two values are equal.
  • -1 if v1 is smaller than v2.
  • 1 if v1 is greater than v2.