From: Dale Weiler Date: Sat, 22 Dec 2012 07:46:43 +0000 (+0000) Subject: Remove more unused code X-Git-Tag: 0.2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9ba655e74cffab0bade87aad855d045a710b0177;p=xonotic%2Fgmqcc.git Remove more unused code --- diff --git a/util.c b/util.c index e0bf1df..2b2f1b0 100644 --- a/util.c +++ b/util.c @@ -176,74 +176,6 @@ char *util_strdup(const char *s) { return ptr; } -/* - * Remove quotes from a string, escapes from \ in string - * as well. This function shouldn't be used to create a - * char array that is later freed (it uses pointer arith) - */ -char *util_strrq(const char *s) { - char *dst = (char*)s; - char *src = (char*)s; - char chr; - while ((chr = *src++) != '\0') { - if (chr == '\\') { - *dst++ = chr; - if ((chr = *src++) == '\0') - break; - *dst++ = chr; - } else if (chr != '"') - *dst++ = chr; - } - *dst = '\0'; - return dst; -} - -/* - * Chops a substring from an existing string by creating a - * copy of it and null terminating it at the required position. - */ -char *util_strchp(const char *s, const char *e) { - const char *c = NULL; - if (!s || !e) - return NULL; - - c = s; - while (c != e) - c++; - - return util_strdup(s); -} - -/* - * Returns true if string is all uppercase, otherwise - * it returns false. - */ -bool util_strupper(const char *str) { - while (*str) { - if(!isupper(*str)) - return false; - str++; - } - return true; -} - -/* - * Returns true if string is all digits, otherwise - * it returns false. - */ -bool util_strdigit(const char *str) { - while (*str) { - if(!isdigit(*str)) - return false; - str++; - } - return true; -} - -bool util_strncmpexact(const char *src, const char *ned, size_t len) { - return (!strncmp(src, ned, len) && !src[len]); -} - void util_debug(const char *area, const char *ms, ...) { va_list va; if (!opts.debug) @@ -258,31 +190,6 @@ void util_debug(const char *area, const char *ms, ...) { va_end (va); } -/* - * Endianess swapping, all data must be stored little-endian. This - * reorders by stride and length, much nicer than other functions for - * certian-sized types like short or int. - */ -#if 0 -void util_endianswap(void *m, int s, int l) { - size_t w = 0; - size_t i = 0; - - /* ignore if we're already LE */ - if(*((char *)&s)) - return; - - for(; w < (size_t)l; w++) { - for(; i < (size_t)(s << 1); i++) { - unsigned char *p = (unsigned char *)m+w*s; - unsigned char t = p[i]; - p[i] = p[s-i-1]; - p[s-i-1] = t; - } - } -} -#endif - /* * only required if big endian .. otherwise no need to swap * data.