diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2014-10-28 21:43:12 -0400 |
---|---|---|
committer | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2014-10-30 13:39:44 +0000 |
commit | 79c977cf0a61b5f2ad724323c1676ba7e3abb2cc (patch) | |
tree | 19a76184ed6357434391cfe5f0617b9f13e77987 /wsutil | |
parent | c0a4a91ec20d2a91fe7b1d7ae3476e042ae86ba7 (diff) |
Remove the optional strncasecmp.{h,c} target (for systems that don't have that API).
strncasecmp() has been prohibited for years (in favor of the g_ascii_ version).
Change-Id: I64b7c29099b1c5240757e2026fe3490096a84755
Reviewed-on: https://code.wireshark.org/review/4980
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/Makefile.am | 6 | ||||
-rw-r--r-- | wsutil/Makefile.common | 3 | ||||
-rw-r--r-- | wsutil/strncasecmp.c | 61 | ||||
-rw-r--r-- | wsutil/strncasecmp.h | 40 | ||||
-rw-r--r-- | wsutil/strptime.c | 11 |
5 files changed, 6 insertions, 115 deletions
diff --git a/wsutil/Makefile.am b/wsutil/Makefile.am index 063ff9fb02..040c90e64d 100644 --- a/wsutil/Makefile.am +++ b/wsutil/Makefile.am @@ -21,8 +21,7 @@ ACLOCAL_AMFLAGS = `../aclocal-flags` # Optional headers for ABI checking -wsutil_optional_abi_includes = \ - @STRNCASECMP_INCLUDES@ +wsutil_optional_abi_includes = # Header files for functions in libwsutil's ABI on this platform. libwsutil_abi_INCLUDES = \ @@ -36,7 +35,6 @@ wsutil_optional_objects = \ @INET_ATON_LO@ \ @INET_NTOP_LO@ \ @INET_PTON_LO@ \ - @STRNCASECMP_LO@ \ @STRPTIME_LO@ if SSE42_SUPPORTED @@ -78,8 +76,6 @@ EXTRA_libwsutil_la_SOURCES= \ inet_ntop.c \ inet_pton.c \ inet_v6defs.h \ - strncasecmp.c \ - strncasecmp.h \ strptime.c \ strptime.h \ wsgetopt.c \ diff --git a/wsutil/Makefile.common b/wsutil/Makefile.common index 48fa8b090f..f59f4c2af2 100644 --- a/wsutil/Makefile.common +++ b/wsutil/Makefile.common @@ -133,8 +133,7 @@ libwsutil_nonrepl_INCLUDES = \ # Header files that are not generated from other files LIBWSUTIL_INCLUDES = \ - $(libwsutil_nonrepl_INCLUDES) \ - strncasecmp.h + $(libwsutil_nonrepl_INCLUDES) # # Editor modelines - https://www.wireshark.org/tools/modelines.html diff --git a/wsutil/strncasecmp.c b/wsutil/strncasecmp.c deleted file mode 100644 index 5dea7599d5..0000000000 --- a/wsutil/strncasecmp.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 1992, 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, write to the Free Software Foundation, Inc., 51 Franklin Street, - Fifth Floor, Boston, MA 02110-1301 USA. */ - -#include <ansidecl.h> -#include <string.h> - -#include "wsutil/strncasecmp.h" - -/* Compare no more than N characters of S1 and S2, - ignoring case, returning less than, equal to or - greater than zero if S1 is lexicographically less - than, equal to or greater than S2. */ -int -strncasecmp (const char *s1, const char *s2, size_t n) -{ - register const unsigned char *p1 = (const unsigned char *) s1; - register const unsigned char *p2 = (const unsigned char *) s2; - unsigned char c1, c2; - - if (p1 == p2 || n == 0) - return 0; - - do - { - c1 = tolower (*p1++); - c2 = tolower (*p2++); - if (c1 == '\0' || c1 != c2) - return c1 - c2; - } while (--n > 0); - - return c1 - c2; -} - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local Variables: - * c-basic-offset: 2 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * ex: set shiftwidth=2 tabstop=8 expandtab: - * :indentSize=2:tabSize=8:noTabs=true: - */ diff --git a/wsutil/strncasecmp.h b/wsutil/strncasecmp.h deleted file mode 100644 index f5f0feb391..0000000000 --- a/wsutil/strncasecmp.h +++ /dev/null @@ -1,40 +0,0 @@ -/* strncasecmp.h - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __STRNCASECMP_H__ -#define __STRNCASECMP_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include "ws_symbol_export.h" - -/* - * Version of "strncasecmp()", for the benefit of OSes that don't have it. - */ -WS_DLL_PUBLIC int strncasecmp (const char *, const char *, size_t); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/wsutil/strptime.c b/wsutil/strptime.c index 5a1eec1db1..d69a0199f3 100644 --- a/wsutil/strptime.c +++ b/wsutil/strptime.c @@ -30,10 +30,7 @@ #include <limits.h> #include <string.h> #include <time.h> - -#ifndef HAVE_STRNCASECMP -#include "wsutil/strncasecmp.h" -#endif +#include <glib.h> #ifdef _LIBC # include "../locale/localeinfo.h" @@ -75,13 +72,13 @@ localtime_r (t, tp) #if defined __GNUC__ && __GNUC__ >= 2 # define match_string(cs1, s2) \ ({ size_t len = strlen (cs1); \ - int result = strncasecmp ((cs1), (s2), len) == 0; \ + int result = g_ascii_strncasecmp ((cs1), (s2), len) == 0; \ if (result) (s2) += len; \ result; }) #else /* Oh come on. Get a reasonable compiler. */ # define match_string(cs1, s2) \ - (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) + (g_ascii_strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) #endif /* We intentionally do not use isdigit() for testing because this will lead to problems with the wide character version. */ @@ -117,7 +114,7 @@ localtime_r (t, tp) while (*alts != '\0') \ { \ size_t len = strlen (alts); \ - if (strncasecmp (alts, rp, len) == 0) \ + if (g_ascii_strncasecmp (alts, rp, len) == 0) \ break; \ alts += len + 1; \ ++val; \ |