From a133ffd8295302ea5fb0ba6f609e811adc7d1d9d Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Tue, 11 Jan 2022 21:34:47 +0100 Subject: 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. --- XUtils.c | 29 ----------------------------- XUtils.h | 2 -- 2 files changed, 31 deletions(-) diff --git a/XUtils.c b/XUtils.c index 96e93cbb..827fa950 100644 --- a/XUtils.c +++ b/XUtils.c @@ -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; diff --git a/XUtils.h b/XUtils.h index eeb214d1..6c096df4 100644 --- a/XUtils.h +++ b/XUtils.h @@ -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. */ -- cgit v1.2.3