Changeset: b9b6547577d3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b9b6547577d3
Modified Files:
clients/mapiclient/ReadlineTools.c
clients/mapiclient/mhelp.c
clients/odbc/driver/ODBCConvert.c
configure.ag
geom/monetdb5/geom.c
Branch: default
Log Message:
merged
diffs (185 lines):
diff --git a/clients/mapiclient/ReadlineTools.c
b/clients/mapiclient/ReadlineTools.c
--- a/clients/mapiclient/ReadlineTools.c
+++ b/clients/mapiclient/ReadlineTools.c
@@ -86,7 +86,6 @@ sql_tablename_generator(const char *text
static char *
sql_command_generator(const char *text, int state)
{
-
static int idx, len;
const char *name;
@@ -95,20 +94,14 @@ sql_command_generator(const char *text,
len = strlen(text);
}
-
while ((name = sql_commands[idx++])) {
-#ifdef HAVE_STRNCASECMP
if (strncasecmp(name, text, len) == 0)
-#else
- if (strncmp(name, text, len) == 0)
-#endif
return strdup(name);
}
return NULL;
}
-
static char **
sql_completion(const char *text, int start, int end)
{
@@ -224,11 +217,7 @@ mal_command_generator(const char *text,
printf("currentline:%s\n",rl_line_buffer); */
while (mal_commands[idx] && (name = mal_commands[idx++])) {
-#ifdef HAVE_STRNCASECMP
if (strncasecmp(name, text, len) == 0)
-#else
- if (strncmp(name, text, len) == 0)
-#endif
return strdup(name);
}
/* try the server to answer */
diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -935,27 +935,6 @@ SQLhelp sqlhelp2[] = {
{NULL, NULL, NULL, NULL, NULL} /* End of list marker */
};
-#ifndef HAVE_STRNCASECMP
-static int
-strncasecmp(const char *s1, const char *s2, size_t n)
-{
- int c1, c2;
-
- while (n > 0) {
- c1 = (unsigned char) *s1++;
- c2 = (unsigned char) *s2++;
- if (c1 == 0)
- return -c2;
- if (c2 == 0)
- return c1;
- if (c1 != c2 && tolower(c1) != tolower(c2))
- return tolower(c1) - tolower(c2);
- n--;
- }
- return 0;
-}
-#endif
-
static const char *
sql_grammar_rule(const char *word, stream *toConsole)
{
diff --git a/clients/odbc/driver/ODBCConvert.c
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -39,27 +39,6 @@ typedef struct {
#endif
} bignum_t;
-#ifndef HAVE_STRNCASECMP
-static int
-strncasecmp(const char *s1, const char *s2, size_t n)
-{
- int c1, c2;
-
- while (n > 0) {
- c1 = (unsigned char) *s1++;
- c2 = (unsigned char) *s2++;
- if (c1 == 0)
- return -c2;
- if (c2 == 0)
- return c1;
- if (c1 != c2 && tolower(c1) != tolower(c2))
- return tolower(c1) - tolower(c2);
- n--;
- }
- return 0;
-}
-#endif
-
/* Parse a number and store in a bignum_t.
* 1 is returned if all is well;
* 2 is returned if there is loss of precision (i.e. overflow of the value);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2665,6 +2665,8 @@ typedef enum {
@%:@include <inttypes.h>
@%:@include <stdbool.h>
@%:@include <assert.h>
+@%:@include <string.h>
+@%:@include <ctype.h>
@%:@ifndef static_assert
/* static_assert is a C11 feature, defined in assert.h which also exists
@@ -2684,6 +2686,35 @@ stpcpy(char *restrict dst, const char *r
}
@%:@endif
+@%:@ifndef HAVE_STPCPY
+#ifndef HAVE_STRNCASECMP
+#ifdef WIN32
+#ifndef strncasecmp
+#define strncasecmp _strnicmp
+#endif
+#else
+static inline int
+strncasecmp(const char *s1, const char *s2, size_t n)
+{
+ int c1, c2;
+
+ while (n > 0) {
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == 0)
+ return -c2;
+ if (c2 == 0)
+ return c1;
+ if (c1 != c2 && tolower(c1) != tolower(c2))
+ return tolower(c1) - tolower(c2);
+ n--;
+ }
+ return 0;
+}
+#endif
+#endif
+@%:@endif
+
@%:@if defined(HAVE___INT128)
typedef __int128 hge;
typedef unsigned __int128 uhge;
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -2116,27 +2116,6 @@ wkba_size(int items)
return size;
}
-#ifndef HAVE_STRNCASECMP
-static int
-strncasecmp(const char *s1, const char *s2, size_t n)
-{
- int c1, c2;
-
- while (n > 0) {
- c1 = (unsigned char) *s1++;
- c2 = (unsigned char) *s2++;
- if (c1 == 0)
- return -c2;
- if (c2 == 0)
- return c1;
- if (c1 != c2 && tolower(c1) != tolower(c2))
- return tolower(c1) - tolower(c2);
- n--;
- }
- return 0;
-}
-#endif
-
/* Creates WKB representation (including srid) from WKT representation */
/* return number of parsed characters. */
static str
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list