Removed unused String_getToken function

Since String_getToken is not used anymore and currently only supports
a 50 char token, simply remove it for now.
This commit is contained in:
Tobias Stoeckmann 2022-01-11 21:34:47 +01:00 committed by BenBE
parent fde1243443
commit a133ffd829
2 changed files with 0 additions and 31 deletions

View File

@ -161,35 +161,6 @@ void String_freeArray(char** s) {
free(s);
}
char* String_getToken(const char* line, const unsigned short int numMatch) {
const size_t len = strlen(line);
char inWord = 0;
unsigned short int count = 0;
char match[50];
size_t foundCount = 0;
for (size_t i = 0; i < len; i++) {
char lastState = inWord;
inWord = line[i] == ' ' ? 0 : 1;
if (lastState == 0 && inWord == 1)
count++;
if (inWord == 1) {
if (count == numMatch && line[i] != ' ' && line[i] != '\0' && line[i] != '\n' && line[i] != (char)EOF) {
if (foundCount == sizeof(match) / sizeof(match[0]) - 1)
break;
match[foundCount] = line[i];
foundCount++;
}
}
}
match[foundCount] = '\0';
return xStrdup(match);
}
char* String_readLine(FILE* fd) {
const size_t step = 1024;
size_t bufSize = step;

View File

@ -54,8 +54,6 @@ char** String_split(const char* s, char sep, size_t* n);
void String_freeArray(char** s);
char* String_getToken(const char* line, unsigned short int numMatch) ATTR_MALLOC;
char* String_readLine(FILE* fd) ATTR_MALLOC;
/* Always null-terminates dest. Caller must pass a strictly positive size. */