groff-commit
[Top][All Lists]
Advanced

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

[groff] 10/18: Use the `strcase` Gnulib module.


From: G. Branden Robinson
Subject: [groff] 10/18: Use the `strcase` Gnulib module.
Date: Sun, 5 Jan 2025 05:22:14 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 3b241554d8da5b7a26cf70b4b5df54816a011c47
Author: Collin Funk <collin.funk1@gmail.com>
AuthorDate: Wed Dec 25 02:16:07 2024 +0000

    Use the `strcase` Gnulib module.
    
    * Makefile.am: Update comment.
    * bootstrap.conf (gnulib_modules): Add strcase.
    * configure.ac: Remove checks for strcasecmp and strncasecmp.
    * src/libs/libgroff/strcasecmp.c: Delete file.
    * src/libs/libgroff/strncasecmp.c: Likewise.
    * src/libs/libgroff/libgroff.am (EXTRA_DIST): Remove deleted files.
    * src/include/lib.h (strcasecmp, strncasecmp): Remove declarations.
    * src/roff/groff/pipeline.c (strcasecmp): Likewise.
    
    See <https://savannah.gnu.org/bugs/?66518>.
---
 ChangeLog                       | 17 ++++++++++
 Makefile.am                     |  4 +--
 bootstrap.conf                  |  1 +
 configure.ac                    |  5 +--
 src/include/lib.h               | 20 ------------
 src/libs/libgroff/libgroff.am   |  2 --
 src/libs/libgroff/strcasecmp.c  | 71 -----------------------------------------
 src/libs/libgroff/strncasecmp.c | 19 -----------
 src/roff/groff/pipeline.c       |  2 --
 9 files changed, 21 insertions(+), 120 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index be0d91097..5025b77cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-12-24  Collin Funk  <collin.funk1@gmail.com>
+
+       Use the `strcase` Gnulib module.
+
+       * Makefile.am: Update comment.
+       * bootstrap.conf (gnulib_modules): Add strcase.
+       * configure.ac: Remove checks for strcasecmp and strncasecmp.
+       * src/libs/libgroff/strcasecmp.c: Delete file.
+       * src/libs/libgroff/strncasecmp.c: Likewise.
+       * src/libs/libgroff/libgroff.am (EXTRA_DIST): Remove deleted
+       files.
+       * src/include/lib.h (strcasecmp, strncasecmp): Remove
+       declarations.
+       * src/roff/groff/pipeline.c (strcasecmp): Likewise.
+
+       See <https://savannah.gnu.org/bugs/?66518>.
+
 2025-01-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * bootstrap: Resync with gnulib upstream.
diff --git a/Makefile.am b/Makefile.am
index 5feef38a0..3e1fee78d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -359,8 +359,8 @@ man7dir=$(manroot)/man$(man7ext)
 
 # Include
 #
-#   {fmod,getcwd,mkstemp,putenv,strcasecmp,
-#    strerror,strncasecmp,strtol}.$(OBJEXT)
+#   {fmod,getcwd,mkstemp,putenv,
+#    strerror,strtol}.$(OBJEXT)
 #
 # in 'LIBOBJS' if your C library is missing the corresponding function.
 
diff --git a/bootstrap.conf b/bootstrap.conf
index 8a5a69267..24d6b0924 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -49,6 +49,7 @@ gnulib_modules="
     stdbool-c99
     stdckdint
     stdint
+    strcase
     strerror
     strsignal
     sys_wait
diff --git a/configure.ac b/configure.ac
index e9420c9ca..be0360fd9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,8 +95,6 @@ GROFF_NEED_DECLARATION([pclose])
 GROFF_NEED_DECLARATION([putenv])
 GROFF_NEED_DECLARATION([rand])
 GROFF_NEED_DECLARATION([srand])
-GROFF_NEED_DECLARATION([strcasecmp])
-GROFF_NEED_DECLARATION([strncasecmp])
 GROFF_NEED_DECLARATION([vfprintf])
 GROFF_SYS_NERR
 GROFF_SYS_ERRLIST
@@ -129,8 +127,7 @@ AC_SUBST([LIBEXT],[$acl_libext])
 AC_FUNC_MMAP
 saved_libs="$LIBS"
 LIBS="$LIBS $LIBC $LIBM"
-AC_REPLACE_FUNCS([fmod getcwd putenv strcasecmp \
-                  strncasecmp strtol])
+AC_REPLACE_FUNCS([fmod getcwd putenv strtol])
 LIBS="$saved_libs"
 AC_CHECK_FUNCS([gettimeofday isatty kill rename setlocale strdup \
                 strsep])
diff --git a/src/include/lib.h b/src/include/lib.h
index 46d6e2c27..a2de10cff 100644
--- a/src/include/lib.h
+++ b/src/include/lib.h
@@ -100,26 +100,6 @@ int mksdir(char *tmpl);
     return (c >= 0 && invalid_char_table[c]);
   }
 
-#ifdef HAVE_STRCASECMP
-#ifdef NEED_DECLARATION_STRCASECMP
-// Ultrix4.3's string.h fails to declare this.
-  int strcasecmp(const char *, const char *); }
-#endif /* NEED_DECLARATION_STRCASECMP */
-#else /* !HAVE_STRCASECMP */
-  int strcasecmp(const char *, const char *);
-#endif /* HAVE_STRCASECMP */
-
-#if !defined(_AIX) && !defined(sinix) && !defined(__sinix__)
-#ifdef HAVE_STRNCASECMP
-#ifdef NEED_DECLARATION_STRNCASECMP
-// SunOS's string.h fails to declare this.
-  int strncasecmp(const char *, const char *, int);
-#endif /* NEED_DECLARATION_STRNCASECMP */
-#else /* !HAVE_STRNCASECMP */
-  int strncasecmp(const char *, const char *, size_t);
-#endif /* HAVE_STRNCASECMP */
-#endif /* !_AIX && !sinix && !__sinix__ */
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/libs/libgroff/libgroff.am b/src/libs/libgroff/libgroff.am
index b43fec4c6..36b83d5ee 100644
--- a/src/libs/libgroff/libgroff.am
+++ b/src/libs/libgroff/libgroff.am
@@ -84,9 +84,7 @@ EXTRA_DIST += \
   src/libs/libgroff/fmod.c \
   src/libs/libgroff/getcwd.c \
   src/libs/libgroff/putenv.c \
-  src/libs/libgroff/strcasecmp.c \
   src/libs/libgroff/strerror.c \
-  src/libs/libgroff/strncasecmp.c \
   src/libs/libgroff/strtol.c \
   src/libs/libgroff/config.charset \
   src/libs/libgroff/ref-add.sin \
diff --git a/src/libs/libgroff/strcasecmp.c b/src/libs/libgroff/strcasecmp.c
deleted file mode 100644
index f9dca5d57..000000000
--- a/src/libs/libgroff/strcasecmp.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* strcasecmp.c -- case insensitive string comparator
-   Copyright (C) 1998-2020 Free Software Foundation, Inc.
-
-   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 3 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, see <http://www.gnu.org/licenses/>.  */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef LENGTH_LIMIT
-# define STRXCASECMP_FUNCTION strncasecmp
-# define STRXCASECMP_DECLARE_N , size_t n
-# define LENGTH_LIMIT_EXPR(Expr) Expr
-#else
-# define STRXCASECMP_FUNCTION strcasecmp
-# define STRXCASECMP_DECLARE_N /* empty */
-# define LENGTH_LIMIT_EXPR(Expr) 0
-#endif
-
-#include <stddef.h>
-#include <ctype.h>
-
-#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
-
-/* Compare {{no more than N characters of }}strings 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
-STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_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 || LENGTH_LIMIT_EXPR (n == 0))
-    return 0;
-
-  do
-    {
-      c1 = TOLOWER (*p1);
-      c2 = TOLOWER (*p2);
-
-      if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0')
-       break;
-
-      ++p1;
-      ++p2;
-    }
-  while (c1 == c2);
-
-  return c1 - c2;
-}
-
-// Local Variables:
-// fill-column: 72
-// mode: C++
-// End:
-// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:
diff --git a/src/libs/libgroff/strncasecmp.c b/src/libs/libgroff/strncasecmp.c
deleted file mode 100644
index ec8aae24d..000000000
--- a/src/libs/libgroff/strncasecmp.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 2014-2020 Free Software Foundation, Inc.
-
-This file is part of groff.
-
-groff 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.
-
-groff 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.
-
-The GNU General Public License version 2 (GPL2) is available in the
-internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */
-
-#define LENGTH_LIMIT
-#include "strcasecmp.c"
diff --git a/src/roff/groff/pipeline.c b/src/roff/groff/pipeline.c
index 5b50ac6ba..df4a85e98 100644
--- a/src/roff/groff/pipeline.c
+++ b/src/roff/groff/pipeline.c
@@ -100,8 +100,6 @@ static const char *sh = "sh";
 static const char *cmd = "cmd";
 static const char *command = "command";
 
-extern int strcasecmp(const char *, const char *);
-
 char *sbasename(const char *path)
 {
   char *base;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]