Mercurial > hg > octave-lojdl > gnulib-hg
changeset 10345:8d80c477e0ad
strverscmp: migrate from "strverscmp.h" to <string.h>
* modules/string (Makefile.am): Add new hooks.
* modules/strverscmp (Files): Remove strverscmp.h.
(Depends-on): Add string.
(configure.ac): Add indicator.
(Include): Mention new header.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Provide new
defaults.
* m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): Inform string module of
results.
* lib/strverscmp.h: Delete.
* lib/string.in.h (strverscmp): Provide declaration, when needed.
* tests/test-strverscmp.c (includes): Adjust client.
* lib/check-version.c (includes): Likewise.
* NEWS: Document the change.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 19 Aug 2008 09:23:40 -0600 |
parents | a5fb0200cceb |
children | 1d6d83874993 |
files | ChangeLog NEWS lib/check-version.c lib/string.in.h lib/strverscmp.h m4/string_h.m4 m4/strverscmp.m4 modules/string modules/strverscmp tests/test-strverscmp.c |
diffstat | 10 files changed, 48 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2008-08-19 Eric Blake <ebb9@byu.net> + strverscmp: migrate from "strverscmp.h" to <string.h> + * modules/string (Makefile.am): Add new hooks. + * modules/strverscmp (Files): Remove strverscmp.h. + (Depends-on): Add string. + (configure.ac): Add indicator. + (Include): Mention new header. + * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Provide new + defaults. + * m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): Inform string module of + results. + * lib/strverscmp.h: Delete. + * lib/string.in.h (strverscmp): Provide declaration, when needed. + * tests/test-strverscmp.c (includes): Adjust client. + * lib/check-version.c (includes): Likewise. + * NEWS: Document the change. + strverscmp: add unit test * modules/strverscmp-tests: New file. * tests/test-strverscmp.c: Likewise.
--- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ Date Modules Changes +2008-08-19 strverscmp The include file is changed from "strverscmp.h" + to <string.h>. + 2008-08-14 lock The include file is changed from "lock.h" to "glthread/lock.h". tls The include file is changed from "tls.h"
--- a/lib/check-version.c +++ b/lib/check-version.c @@ -1,6 +1,6 @@ /* check-version.h --- Check version string compatibility. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free - Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2008 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 @@ -23,7 +23,7 @@ #include <config.h> #include <stddef.h> -#include <strverscmp.h> +#include <string.h> /* Get specification. */ #include "check-version.h"
--- a/lib/string.in.h +++ b/lib/string.in.h @@ -576,6 +576,18 @@ strsignal (a)) #endif +#if @GNULIB_STRVERSCMP@ +# if !@HAVE_STRVERSCMP@ +extern int strverscmp (const char *, const char *); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strverscmp +# define strverscmp(a, b) \ + (GL_LINK_WARNING ("strverscmp is unportable - " \ + "use gnulib module strverscmp for portability"), \ + strverscmp (a, b)) +#endif + #ifdef __cplusplus }
deleted file mode 100644 --- a/lib/strverscmp.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Compare strings while treating digits characters numerically. - - Copyright (C) 1997, 2003 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 2, 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 STRVERSCMP_H_ -# define STRVERSCMP_H_ - -int strverscmp (const char *, const char *); - -#endif /* not STRVERSCMP_H_ */
--- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 5 # Written by Paul Eggert. @@ -63,6 +63,7 @@ GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) + GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) @@ -81,6 +82,7 @@ HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) + HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
--- a/m4/strverscmp.m4 +++ b/m4/strverscmp.m4 @@ -1,5 +1,6 @@ -# strverscmp.m4 serial 5 -dnl Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc. +# strverscmp.m4 serial 6 +dnl Copyright (C) 2002, 2005, 2006, 2007, 2008 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,9 +10,11 @@ dnl Persuade glibc <string.h> to declare strverscmp(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REPLACE_FUNCS(strverscmp) if test $ac_cv_func_strverscmp = no; then gl_PREREQ_STRVERSCMP + HAVE_STRVERSCMP=0 fi ])
--- a/modules/string +++ b/modules/string @@ -54,6 +54,7 @@ -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ + -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ @@ -71,6 +72,7 @@ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
--- a/modules/strverscmp +++ b/modules/strverscmp @@ -2,20 +2,21 @@ Compare strings holding version numbers. Files: -lib/strverscmp.h lib/strverscmp.c m4/strverscmp.m4 Depends-on: extensions +string configure.ac: gl_FUNC_STRVERSCMP +gl_STRING_MODULE_INDICATOR([strverscmp]) Makefile.am: Include: -"strverscmp.h" +<string.h> License: LGPLv2+