mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
mbslen: Avoid collision with system function.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
2010-01-07 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
|
mbslen: Avoid collision with system function.
|
||||||
|
* lib/string.in.h [MirBSD]: Include <wchar.h>.
|
||||||
|
(mbslen): Undefine first. Alias mbslen to rpl_mbslen.
|
||||||
|
* m4/mbslen.m4: New file.
|
||||||
|
* modules/mbslen (Files): Add it.
|
||||||
|
(configure.ac): Invoke gl_MBSLEN.
|
||||||
|
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Initialize HAVE_MBSLEN.
|
||||||
|
* modules/string (Makefile.am): Substitute HAVE_MBSLEN.
|
||||||
|
Reported by Nelson H. F. Beebe <beebe@math.utah.edu>
|
||||||
|
via Ian Beckwith <ianb@erislabs.net>.
|
||||||
|
|
||||||
2010-01-07 Bruno Haible <bruno@clisp.org>
|
2010-01-07 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
dirent: Document the last fix.
|
dirent: Document the last fix.
|
||||||
|
@@ -31,6 +31,11 @@
|
|||||||
/* NetBSD 5.0 mis-defines NULL. */
|
/* NetBSD 5.0 mis-defines NULL. */
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* MirBSD defines mbslen as a macro. */
|
||||||
|
#if @GNULIB_MBSLEN@ && defined __MirBSD__
|
||||||
|
# include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __attribute__
|
#ifndef __attribute__
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|
||||||
@@ -439,6 +444,12 @@ extern char *strtok_r (char *restrict s, char const *restrict delim,
|
|||||||
#if @GNULIB_MBSLEN@
|
#if @GNULIB_MBSLEN@
|
||||||
/* Return the number of multibyte characters in the character string STRING.
|
/* Return the number of multibyte characters in the character string STRING.
|
||||||
This considers multibyte characters, unlike strlen, which counts bytes. */
|
This considers multibyte characters, unlike strlen, which counts bytes. */
|
||||||
|
# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
|
||||||
|
# undef mbslen
|
||||||
|
# endif
|
||||||
|
# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */
|
||||||
|
# define mbslen rpl_mbslen
|
||||||
|
# endif
|
||||||
extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1));
|
extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
16
m4/mbslen.m4
Normal file
16
m4/mbslen.m4
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# mbslen.m4 serial 1
|
||||||
|
dnl Copyright (C) 2010 Free Software 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.
|
||||||
|
|
||||||
|
AC_DEFUN([gl_MBSLEN],
|
||||||
|
[
|
||||||
|
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
|
||||||
|
AC_CHECK_FUNCS_ONCE([mbslen])
|
||||||
|
if test $ac_cv_func_mbslen = yes; then
|
||||||
|
HAVE_MBSLEN=1
|
||||||
|
else
|
||||||
|
HAVE_MBSLEN=0
|
||||||
|
fi
|
||||||
|
])
|
@@ -1,11 +1,11 @@
|
|||||||
# Configure a GNU-like replacement for <string.h>.
|
# Configure a GNU-like replacement for <string.h>.
|
||||||
|
|
||||||
# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2010 Free Software Foundation, Inc.
|
||||||
# This file is free software; the Free Software Foundation
|
# This file is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
# serial 9
|
# serial 10
|
||||||
|
|
||||||
# Written by Paul Eggert.
|
# Written by Paul Eggert.
|
||||||
|
|
||||||
@@ -65,6 +65,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
|
|||||||
GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
|
GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
|
||||||
GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
|
GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
|
||||||
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
|
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
|
||||||
|
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
|
||||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||||
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
|
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
|
||||||
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
|
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
|
||||||
|
@@ -3,12 +3,14 @@ mbslen() function: Determine the number of multibyte characters in a string.
|
|||||||
|
|
||||||
Files:
|
Files:
|
||||||
lib/mbslen.c
|
lib/mbslen.c
|
||||||
|
m4/mbslen.m4
|
||||||
|
|
||||||
Depends-on:
|
Depends-on:
|
||||||
mbuiter
|
mbuiter
|
||||||
string
|
string
|
||||||
|
|
||||||
configure.ac:
|
configure.ac:
|
||||||
|
gl_MBSLEN
|
||||||
gl_STRING_MODULE_INDICATOR([mbslen])
|
gl_STRING_MODULE_INDICATOR([mbslen])
|
||||||
|
|
||||||
Makefile.am:
|
Makefile.am:
|
||||||
|
@@ -59,6 +59,7 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
|
|||||||
-e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
|
-e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
|
||||||
-e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
|
-e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
|
||||||
-e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
|
-e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
|
||||||
|
-e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
|
||||||
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
|
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
|
||||||
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
|
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
|
||||||
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
|
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
|
||||||
|
Reference in New Issue
Block a user