diff options
Diffstat (limited to 'src/common/utils.c')
-rw-r--r-- | src/common/utils.c | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/src/common/utils.c b/src/common/utils.c index 25ada1ce5..c06e57083 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -51,95 +51,6 @@ void dump(unsigned char *buffer, int num) printf("\n"); } -//NOTE: There is no need to use this function as the standard sqrt is plenty fast as it is. [Skotlex] -int newt_sqrt(int input) -{ - int new_value, value = input/2, count = 0; - if (!value) //Division by zero fix, pointed out by Shinomori. [Skotlex] - return input; - do - { - new_value = (value + input/value)>>1; - if (abs(value - new_value) <= 1) - return new_value; - value = new_value; - } - while (count++ < 25); - return new_value; -} - -#if defined(_WIN32) && !defined(MINGW) -char *rindex(char *str, char c) -{ - char *sptr; - - sptr = str; - while(*sptr) - ++sptr; - if (c == '\0') - return(sptr); - while(str != sptr) - if (*sptr-- == c) - return(++sptr); - return(NULL); -} - -int strcasecmp(const char *arg1, const char *arg2) -{ - int chk, i; - - if (arg1 == NULL || arg2 == NULL) { - ShowError("strcasecmp: received a NULL pointer, %p or %p.\n", arg1, arg2); - return (0); - } - - for (i = 0; arg1[i] || arg2[i]; i++) - if ((chk = LOWER(arg1[i]) - LOWER(arg2[i])) != 0) - return (chk); /* not equal */ - - return (0); -} - -int strncasecmp(const char *arg1, const char *arg2, size_t n) -{ - int chk, i; - - if (arg1 == NULL || arg2 == NULL) { - ShowError("strncasecmp(): received a NULL pointer, %p or %p.\n", arg1, arg2); - return (0); - } - - for (i = 0; (arg1[i] || arg2[i]) && (n > 0); i++, n--) - if ((chk = LOWER(arg1[i]) - LOWER(arg2[i])) != 0) - return (chk); /* not equal */ - - return (0); -} - -void str_upper(char *name) -{ - - int len = (int)strlen(name); - while (len--) { - if (*name >= 'a' && *name <= 'z') - *name -= ('a' - 'A'); - name++; - } -} - -void str_lower(char *name) -{ - int len = (int)strlen(name); - - while (len--) { - if (*name >= 'A' && *name <= 'Z') - *name += ('a' - 'A'); - name++; - } -} - -#endif - // Allocate a StringBuf [MouseJstr] struct StringBuf * StringBuf_Malloc() { |