'Clean' string handling in ufo:ai code
Initializing strings
char string[BUFFER_SIZE]; // BUFFER_SIZE may have a different name
string[0] = '\0';
Checking for initialized strings
if (stringVar[0] != '\0') {
/* string is not empty */
} else {
/* string is zero/empty */
}
Copy strings
Com_sprintf(string, BUFFER_SIZE, "teststring %s: %i", something->name, thisIsInt);
Com_sprintf(string, sizeof(string), "teststring %i", intNumber);
Q_strncpyz(string, thisIsAnotherStringPointer, BUFFER_SIZE);
Compare strings
if (!Q_strncmp(string, "test", 4)) {
/* string has "test" in it */
}
When using Q_strncmp you have to keep in mind, that string like testSomethingOtherVeryLongHere also match on the above Q_strncmp call.
Werner
EDIT: removed gettext example