diff options
-rw-r--r-- | gl/Makefile.am | 9 | ||||
-rw-r--r-- | gl/base64.c | 40 | ||||
-rw-r--r-- | gl/intprops.h (renamed from gl/tests/intprops.h) | 11 | ||||
-rw-r--r-- | gl/m4/extern-inline.m4 | 18 | ||||
-rw-r--r-- | gl/m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 2 | ||||
-rw-r--r-- | gl/tests/Makefile.am | 7 | ||||
-rw-r--r-- | maint.mk | 3 |
8 files changed, 64 insertions, 29 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index 85ca9b6506..43e17e9723 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca base64 bind byteswap c-ctype close connect extensions func gendocs getaddrinfo getpass gettext gettimeofday hash-pjw-bare havelib iconv inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file recv recvfrom select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca base64 bind byteswap c-ctype close connect extensions func gendocs getaddrinfo getpass gettext gettimeofday hash-pjw-bare havelib iconv inet_ntop inet_pton intprops lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file recv recvfrom select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings AUTOMAKE_OPTIONS = 1.9.6 gnits @@ -454,6 +454,13 @@ EXTRA_libgnu_la_SOURCES += inet_pton.c ## end gnulib module inet_pton +## begin gnulib module intprops + + +EXTRA_DIST += intprops.h + +## end gnulib module intprops + ## begin gnulib module listen diff --git a/gl/base64.c b/gl/base64.c index f9ea4e45c4..568389a903 100644 --- a/gl/base64.c +++ b/gl/base64.c @@ -59,6 +59,27 @@ to_uchar (char ch) return ch; } +static const char b64c[64] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +/* Base64 encode IN array of size INLEN into OUT array. OUT needs + to be of length >= BASE64_LENGTH(INLEN), and INLEN needs to be + a multiple of 3. */ +static void +base64_encode_fast (const char *restrict in, size_t inlen, char *restrict out) +{ + while (inlen) + { + *out++ = b64c[to_uchar (in[0]) >> 2]; + *out++ = b64c[((to_uchar (in[0]) << 4) + (to_uchar (in[1]) >> 4)) & 0x3f]; + *out++ = b64c[((to_uchar (in[1]) << 2) + (to_uchar (in[2]) >> 6)) & 0x3f]; + *out++ = b64c[to_uchar (in[2]) & 0x3f]; + + inlen -= 3; + in += 3; + } +} + /* Base64 encode IN array of size INLEN into OUT array of size OUTLEN. If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as possible. If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero @@ -67,28 +88,35 @@ void base64_encode (const char *restrict in, size_t inlen, char *restrict out, size_t outlen) { - static const char b64str[64] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + /* Note this outlen constraint can be enforced at compile time. + I.E. that the output buffer is exactly large enough to hold + the encoded inlen bytes. The inlen constraints (of corresponding + to outlen, and being a multiple of 3) can change at runtime + at the end of input. However the common case when reading + large inputs is to have both constraints satisfied, so we depend + on both in base_encode_fast(). */ + if (outlen % 4 == 0 && inlen == outlen / 4 * 3) + return base64_encode_fast (in, inlen, out); while (inlen && outlen) { - *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f]; + *out++ = b64c[to_uchar (in[0]) >> 2]; if (!--outlen) break; - *out++ = b64str[((to_uchar (in[0]) << 4) + *out++ = b64c[((to_uchar (in[0]) << 4) + (--inlen ? to_uchar (in[1]) >> 4 : 0)) & 0x3f]; if (!--outlen) break; *out++ = (inlen - ? b64str[((to_uchar (in[1]) << 2) + ? b64c[((to_uchar (in[1]) << 2) + (--inlen ? to_uchar (in[2]) >> 6 : 0)) & 0x3f] : '='); if (!--outlen) break; - *out++ = inlen ? b64str[to_uchar (in[2]) & 0x3f] : '='; + *out++ = inlen ? b64c[to_uchar (in[2]) & 0x3f] : '='; if (!--outlen) break; if (inlen) diff --git a/gl/tests/intprops.h b/gl/intprops.h index f57f9b4dda..54c23437e4 100644 --- a/gl/tests/intprops.h +++ b/gl/intprops.h @@ -3,16 +3,16 @@ Copyright (C) 2001-2005, 2009-2013 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 + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 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. + GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Paul Eggert. */ @@ -89,7 +89,8 @@ /* Return 1 if the __typeof__ keyword works. This could be done by 'configure', but for now it's easier to do it by hand. */ -#if 2 <= __GNUC__ || defined __IBM__TYPEOF__ || 0x5110 <= __SUNPRO_C +#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) # define _GL_HAVE___TYPEOF__ 1 #else # define _GL_HAVE___TYPEOF__ 0 diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 index e4454d8fe3..9f93c29e4d 100644 --- a/gl/m4/extern-inline.m4 +++ b/gl/m4/extern-inline.m4 @@ -1,4 +1,3 @@ -# extern-inline.m4 serial 2 dnl 'extern inline' a la ISO C99. dnl Copyright 2012-2013 Free Software Foundation, Inc. @@ -20,15 +19,20 @@ AC_DEFUN([gl_EXTERN_INLINE], 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. - Suppress the use of extern inline on problematic Apple configurations, as - Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., + Suppress the use of extern inline on problematic Apple configurations. + OS X 10.8 and earlier mishandle it; see, e.g., <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. Perhaps Apple will fix this some day. */ #if (defined __APPLE__ \ - && ((! defined _DONT_USE_CTYPE_INLINE_ \ - && (defined __GNUC__ || defined __cplusplus)) \ - || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ - && defined __GNUC__ && ! defined __cplusplus))) + && (defined __header_inline \ + ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ + && ! defined __clang__) \ + : ((! defined _DONT_USE_CTYPE_INLINE_ \ + && (defined __GNUC__ || defined __cplusplus)) \ + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + && defined __GNUC__ && ! defined __cplusplus)))) # define _GL_EXTERN_INLINE_APPLE_BUG #endif #if ((__GNUC__ \ diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 8fd1dab998..6540575a70 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca base64 bind byteswap c-ctype close connect extensions func gendocs getaddrinfo getpass gettext gettimeofday hash-pjw-bare havelib iconv inet_ntop inet_pton lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file recv recvfrom select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings +# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alloca base64 bind byteswap c-ctype close connect extensions func gendocs getaddrinfo getpass gettext gettimeofday hash-pjw-bare havelib iconv inet_ntop inet_pton intprops lib-msvc-compat lib-symbol-versions listen maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file recv recvfrom select send sendto servent setsockopt shutdown snprintf socket sockets socklen stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gl/override]) @@ -52,6 +52,7 @@ gl_MODULES([ iconv inet_ntop inet_pton + intprops lib-msvc-compat lib-symbol-versions listen diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index d8c8792e49..8ced96a105 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -921,6 +921,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/hash-pjw-bare.h lib/inet_ntop.c lib/inet_pton.c + lib/intprops.h lib/itold.c lib/listen.c lib/lseek.c @@ -1275,7 +1276,6 @@ AC_DEFUN([gl_FILE_LIST], [ tests=lib/glthread/lock.h tests=lib/glthread/threadlib.c tests=lib/ignore-value.h - tests=lib/intprops.h tests=lib/inttypes.in.h tests=lib/ioctl.c tests=lib/lstat.c diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am index f20087cf59..7fcd478c05 100644 --- a/gl/tests/Makefile.am +++ b/gl/tests/Makefile.am @@ -480,13 +480,6 @@ EXTRA_DIST += test-inet_pton.c signature.h macros.h ## end gnulib module inet_pton-tests -## begin gnulib module intprops - - -EXTRA_DIST += intprops.h - -## end gnulib module intprops - ## begin gnulib module intprops-tests TESTS += test-intprops @@ -1287,12 +1287,13 @@ gnulib-version = $$(cd $(gnulib_dir) \ && { git describe || git rev-parse --short=10 HEAD; } ) bootstrap-tools ?= autoconf,automake,gnulib +gpgv = $$(gpgv2 --version >/dev/null && echo gpgv2 || echo gpgv) # If it's not already specified, derive the GPG key ID from # the signed tag we've just applied to mark this release. gpg_key_ID ?= \ $$(cd $(srcdir) \ && git cat-file tag v$(VERSION) \ - | gpgv --status-fd 1 --keyring /dev/null - - 2>/dev/null \ + | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null \ | awk '/^\[GNUPG:\] ERRSIG / {print $$3; exit}') translation_project_ ?= coordinator@translationproject.org |