summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/utils.c89
-rw-r--r--src/common/utils.h10
2 files changed, 0 insertions, 99 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()
{
diff --git a/src/common/utils.h b/src/common/utils.h
index 120224852..efd477c9b 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -13,17 +13,7 @@
#define LOWER(c) (((c)>='A' && (c) <= 'Z') ? ((c)+('a'-'A')) : (c))
#define UPPER(c) (((c)>='a' && (c) <= 'z') ? ((c)+('A'-'a')) : (c) )
-/* strcasecmp -> stricmp -> str_cmp */
-#if defined(_WIN32) && !defined(MINGW)
- int strcasecmp(const char *arg1, const char *arg2);
- int strncasecmp(const char *arg1, const char *arg2, size_t n);
- void str_upper(char *name);
- void str_lower(char *name);
- char *rindex(char *str, char c);
-#endif
-
void dump(unsigned char *buffer, int num);
-int newt_sqrt(int value); //Newton aproximation for getting a fast sqrt.
struct StringBuf {
char *buf_;