EDCS Reference Manual
Functions
EDCS CloneString
extern EDCS_Status_Code
EDCS_CloneString
(
const EDCS_String  *src_ptr,1
EDCS_String  *dest_ptr2
);

Definition

Clones the data from *src_ptr into *dest_ptr, by allocating memory for any necessary internal pointers within *dest_ptr, then populating *dest_ptr with data from *src_ptr.

IMPORTANT NOTES:

  1. Because some of the fields contained in the data structure are pointers to dynamically allocated memory, it is HIGHLY INADVISABLE to use a member-wise structure copy in order to duplicate an EDCS_String structure. In order to reliably duplicate this data, developers should use the EDCS_CloneString() function.
  2. The caller is responsible for calling EDCS_FreeString() to free the internal pointers allocated within *dest_ptr.


Returns

EDCS_SC_SUCCESS and memory is allocated for any dynamically allocated data within the structure, and it is populated with data copied from *src_ptr, if valid parameters were passed in.
EDCS_SC_NULL_REQUIRED_PARAMETER and *dest_ptr is left unchanged, if dest_ptr or src_ptr was NULL.
EDCS_SC_OTHER_FAILURE and *dest_ptr is set to its (empty) default value, if the API could not allocate the memory for the dynamically allocated memory it should refer to.

Parameters Notes

1 the string that is to be duplicated

2 a pointer to an EDCS_String structure within memory managed by the caller. Non-dynamically allocated fields in this structure will be directly populated with data from the input fields. Dynamically allocated data will be allocated by this function, then copied from the input structure.


Prev: EDCS_CloneAttributeValue. Next: EDCS_CompareAttributeValues. Up:Index.