Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/citrus make sure that key is case-insensitive.



details:   https://anonhg.NetBSD.org/src/rev/af0460fb994b
branches:  trunk
changeset: 548397:af0460fb994b
user:      tshiozak <tshiozak%NetBSD.org@localhost>
date:      Thu Jun 26 12:05:04 2003 +0000

description:
make sure that key is case-insensitive.

diffstat:

 lib/libc/citrus/citrus_lookup.c         |  18 ++++++++++--------
 lib/libc/citrus/citrus_lookup_factory.c |   5 +++--
 2 files changed, 13 insertions(+), 10 deletions(-)

diffs (76 lines):

diff -r 272a9fdff657 -r af0460fb994b lib/libc/citrus/citrus_lookup.c
--- a/lib/libc/citrus/citrus_lookup.c   Thu Jun 26 12:04:47 2003 +0000
+++ b/lib/libc/citrus/citrus_lookup.c   Thu Jun 26 12:05:04 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_lookup.c,v 1.1 2003/06/25 09:51:34 tshiozak Exp $       */
+/*     $NetBSD: citrus_lookup.c,v 1.2 2003/06/26 12:05:04 tshiozak Exp $       */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lookup.c,v 1.1 2003/06/25 09:51:34 tshiozak Exp $");
+__RCSID("$NetBSD: citrus_lookup.c,v 1.2 2003/06/26 12:05:04 tshiozak Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -120,9 +120,10 @@
        cl->cl_rewind = 0;
        free(cl->cl_key);
        cl->cl_key = strdup(key);
-       cl->cl_keylen = strlen(key);
+       _bcs_convert_to_lower(cl->cl_key);
+       cl->cl_keylen = strlen(cl->cl_key);
        _db_locator_init(&cl->cl_dblocator);
-       return _db_lookup_by_s(cl->cl_db, key, data, &cl->cl_dblocator);
+       return _db_lookup_by_s(cl->cl_db, cl->cl_key, data, &cl->cl_dblocator);
 }
 
 static void
@@ -226,13 +227,14 @@
        const char *p;
 
        cl->cl_rewind = 0;
+       free(cl->cl_key);
+       cl->cl_key = strdup(key);
+       _bcs_convert_to_lower(cl->cl_key);
+       cl->cl_keylen = strlen(cl->cl_key);
        _memstream_bind(&cl->cl_plainms, &cl->cl_plainr);
-       p = _memstream_matchline(&cl->cl_plainms, key, &len, 0);
+       p = _memstream_matchline(&cl->cl_plainms, cl->cl_key, &len, 0);
        if (p == NULL)
                return ENOENT;
-       free(cl->cl_key);
-       cl->cl_key = strdup(key);
-       cl->cl_keylen = strlen(key);
        if (data)
                /* LINTED: discard const */
                _region_init(data, (char *)p, len);
diff -r 272a9fdff657 -r af0460fb994b lib/libc/citrus/citrus_lookup_factory.c
--- a/lib/libc/citrus/citrus_lookup_factory.c   Thu Jun 26 12:04:47 2003 +0000
+++ b/lib/libc/citrus/citrus_lookup_factory.c   Thu Jun 26 12:05:04 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_lookup_factory.c,v 1.1 2003/06/25 09:51:35 tshiozak Exp $       */
+/*     $NetBSD: citrus_lookup_factory.c,v 1.2 2003/06/26 12:05:04 tshiozak Exp $       */
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lookup_factory.c,v 1.1 2003/06/25 09:51:35 tshiozak Exp $");
+__RCSID("$NetBSD: citrus_lookup_factory.c,v 1.2 2003/06/26 12:05:04 tshiozak Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -67,6 +67,7 @@
        if (p==line)
                return 0;
        snprintf(key, sizeof(key), "%.*s", (int)(p-line), line);
+       _bcs_convert_to_lower(key);
 
        /* data */
        line = _bcs_skip_ws_len(p, &len);



Home | Main Index | Thread Index | Old Index