Definition: | #include <CDM.h> |
---|
|
Prototype: | char * CDM_Strdup(const char *string);
|
---|
Arguments: | string: The string to be duplicated (char *)
|
---|
|
|
Prototype: | char * CDM_Strdup(Tcl_Obj *stringObj);
|
---|
Arguments: | stringObj: The object containing the string to be duplicated (Tcl_Obj *)
|
---|
|
|
Description:
char * CDM_Strdup(const char *string): |
This function duplicates the provided by the "string" parameter UTF-8
string, just as ANSI C "strdup" duplicates ASCII strings. A new memory
space large enough to hold the provided string will be allocated and the
provided string will be copied to this new allocated buffer. Memory for
the new string is obtained with the use of Tcl_Alloc, and can be freed
by either calling Tcl_Free or CDM_Free. The return value of this
function is a pointer to this newly allocated memory buffer. CDM applications should use this routine instead of strdup,
as strdup DOES NOT HANDLE CORRECTLY UTF-8 strings!
char * CDM_Strdup(Tcl_Obj *stringObj): |
This function duplicates the UTF-8 string contained in the (CDM or Tcl)
object specified by the "stringObj" parameter. A new memory
space large enough to hold the string will be allocated and the
string will be copied to this new allocated buffer. Memory for
the new string is obtained with the use of Tcl_Alloc, and can be freed
by either calling Tcl_Free or CDM_Free. The return value of this
function is a pointer to this newly allocated memory buffer. CDM applications should use this routine instead of strdup,
as strdup DOES NOT HANDLE CORRECTLY UTF-8 strings!
Return Value:
char * CDM_Strdup(const char *string): |
This function returns a pointer (of type char *) to a newly allocated
memory space where the provided UTF-8 string has been copied. Note that
CDM does not own this memory space and the caller is responsible for
freing it by using CDM_Free or Tcl_Free.char * CDM_Strdup(Tcl_Obj *stringObj): |
This function returns a pointer (of type char *) to a newly allocated
memory space where the provided UTF-8 string has been copied. Note that
CDM does not own this memory space and the caller is responsible for
freing it by using CDM_Free or Tcl_Free.
Notes:
char * CDM_Strdup(const char *string): |
Note that ANSI C "strdup" may not operate correctly on UTF-8 strings,
as results may vary according to the operating system and
internationalisation environment used.char * CDM_Strdup(Tcl_Obj *stringObj): |
Note that ANSI C "strdup" may not operate correctly on UTF-8 strings,
as results may vary according to the operating system and
internationalisation environment used. Also note that although the type of the "stringObj" parameter is
(Tcl_Obj *), this function will accept any of the following types:
CDM_Annotation, CDM_AnnotationSet, CDM_Attribute, CDM_AttributeSet,
CDM_AttributeName, CDM_AttributeValue, CDM_ByteSequence,
CDM_ByteSequenceSet, CDM_RawData, CDM_RawDataSet, CDM_SpanSet, CDM_Span
(Tcl_Obj *)
See Also:
char * CDM_Strdup(const char *string): |
CDM_Free, Tcl_Freechar * CDM_Strdup(Tcl_Obj *stringObj): |
CDM_Free, Tcl_Free
Generated by: petasis@aias on Wed Aug 16 10:31:57 PM EEST 2006.