Strings in C are represented by arrays of characters.The end of the string is marked with a special character, the null character, which is simply the character with the value 0. Whenever we write a string, enclosed in double quotes, C automatically creates an array of characters for us, containing that string, terminated by the NULL character.
FIXME: this comment is plain copy/pasted from cdg.c
The symbol table cdgSymbolTable)is used to share strings registered (cdgRegisterString()) to it. Sharing strings speeds up string comparison alot as we dont need strcmp for this any more. A pointer comarison suffices. So we store strings in a hash. But be warned: changing a registered string directly will break things seriously. If you need to change a registered string, make a copy of it (strCopy), manipulate it for your needs and then register it once again.
|
deallocated a SharedString. This function deallocates a SharedString and its workload. Definition at line 335 of file string.c. References SharedStringStruct::data. Referenced by _strDeleteStoreEntry(), and strDelete(). |
|
deallocate a key value pair.
This is used to deallocate the key and the value of the References _strDeleteSharedString(). Referenced by strFinalize(). |
|
lookup a string in the string store. This function returns a pointer to a SharedString if the given string argument is already shared, or NULL if this string isn't shared yet. Definition at line 169 of file string.c. References _strStore, and hashGet(). Referenced by _strTryRegister(), strDelete(), and strRegister(). |
|
allocate a new SharedString. This function constructs a new SharedString. It contains no worload data yet. Definition at line 297 of file string.c. References SharedStringStruct::counter, and SharedStringStruct::data. Referenced by strRegister(). |
|
try to register a new string. This function only registers new strings. It will not increase the reference counter of an already registered string. In any case it will return a known string. Definition at line 183 of file string.c. References _strLookup(), and strRegister(). Referenced by strCat(). |
|
concatenates many strings together. This function allocates the memory for the result string. The argument strings are not modified by the function. The last string in the argument list must be NULL.
References listAppendElement(), listDelete(), and strFromList(). |
|
concatenates two strings.
This is our version of the standard unix strcat() with the differences that both arguments are
References _strTryRegister(), strPrintf(), and strRegister(). |
|
this performs string copying function. This function constructs a copy of the given source string. The returned string is not shared any more as its source might have been. So in order to manipulate a shared string, first strCopy() it, then alter it and strRegister() it finaly. While copying the string new memory is allocated for you. Take care of it.
Referenced by strFromList(), and strRegister(). |
|
Translate a string from unicode UTF-8 to ISO-8859-1. The String will be left untouched if there is any problem while decoding. Definition at line 450 of file string.c. References strRegister(). |
|
unregister a string This function tries deallocate the
Note, that the pointer References _strDeleteSharedString(), _strLookup(), _strStore, SharedStringStruct::counter, and hashRemove(). |
|
module finalization routine.
This function is only called by blahInitialize() and should not be used from outside It basically deallocates the References _strDeleteStoreEntry(), _strStore, hashForEach(), hashForEachFree(), hashListOfKeys(), hashSize(), listElement(), listNext(), and listSize(). Referenced by blahFinalize(). |
|
concatenates a list of strings. This function takes a list of strings and concatenates them together in a newly allocated string. Be sure that all list elements are realy of type string. We can't grant that here. If the list is NULL or empty NULL is returned to you. The return value is a registered string.
References listElement(), listNext(), listSize(), strCopy(), and strRegister(). Referenced by strAppend(). |
|
module initialization routine.
This function is only called by blahInitialize() and should not be used from outside It basically allocates the References _strStore, hashNew(), hashStringEqualFunction(), and hashStringHashFunction(). Referenced by blahInitialize(). |
|
returns a formated string. This function basically has been taken from the sprintf() manual page. The differences between sprintf() and strPrintf() are that you don't have to bother about memory allocation. We allocate enuf memory to hold the formated result string. Further more then this string is strRegister()ed for you, so you might get an already shared string returned to you. Use strDelete() to indicate your lake of interest on the result string. Definition at line 152 of file string.c. References strVPrintf(). Referenced by strCat(). |
|
register a string in symbol table.
This function registers a string to be shared. This is done by copying it into the References _strLookup(), _strNewSharedString(), _strStore, SharedStringStruct::counter, SharedStringStruct::data, hashSet(), and strCopy(). Referenced by _strTryRegister(), strCat(), strDecode(), strFromList(), and strVPrintf(). |
|
return the number of shared strings. Definition at line 406 of file string.c. References _strStore, and hashSize(). |
|
returns a formated string. This function is our version of vsprintf(). See strPrintf() for more information. Definition at line 117 of file string.c. References strRegister(). Referenced by strPrintf(). |
|
container for shared strings. This global variable stores all registered strings Definition at line 61 of file string.c. Referenced by _strLookup(), strDelete(), strFinalize(), strInitialize(), strRegister(), and strStoreSize(). |