Set string allocation style

saf_setProps_StrMode is a function defined in libprops.c.

Synopsis:

int saf_setProps_StrMode(SAF_LibProps *properties, SAF_StrMode mode)

Formal Arguments:

  • properties: The library property list which will be modified by this function (See *Properties*).
  • mode: The string allocation mode, one of SAF__STRMODE_LIB, SAF__STRMODE_CLIENT, or SAF__STRMODE_POOL.

Description: By default, the library allocates memory for returned strings and the client is expected to free that memory when it is no longer needed. However, by calling saf_setProps_StrMode the client can set library properties which change this mode of operation. Possible values are SAF__STRMODE_LIB, the default; SAF__STRMODE_CLIENT, which means that the client will always allocate space for the string return value (and free it also); and SAF__STRMODE_POOL, which means that the library will allocate space for the string return values from a recirculating pool, freeing the memory which has been least recently allocated. The saf_setProps_StrPoolSize function can be used to change the default size of the pool. (See *Returned Strings*).

Preconditions:

  • properties must be a valid library properties handle. (low-cost)

Return Value: The constant SAF__SUCCESS is returned when this function is successful. Otherwise this function either returns an error number or throws an exception, depending on the value of the library’s error handling property.

Parallel Notes: This function can be called independently.

See Also: