Common data type for text variables.

This data type encapsulate a standard C char array. Its recommended to use this type if you need variables holding text. Its caches the length of the C string to avoid repetive calls to strlen, thus improving performance. Its also safer to explicitly give the length to string operations of the core or C libraries to prevent problems because of buffer overflows and missing null-termination. Important: The char array inside this type is not null-terminated. So if you need to work with external functions that rely on this termination you must add a zero at the end by yourself. Keep in mind that the length of the char array is normally not large enough to store this additional null-termination. So you must copy the char array to a new buffer that is (len + 1) big, otherwise memory corruption and undefinied behavour will occur. Most libraries provides also functions that can work with an explicit given length, thus avoiding the need for this copy operation.

Generated on Thu Feb 9 08:01:23 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6