]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Update.
authorSimon Josefsson <simon@josefsson.org>
Sun, 13 Aug 2006 15:27:49 +0000 (15:27 +0000)
committerSimon Josefsson <simon@josefsson.org>
Sun, 13 Aug 2006 15:27:49 +0000 (15:27 +0000)
gl/Makefile.am
gl/m4/gc.m4
gl/m4/getaddrinfo.m4
gl/m4/gnulib-comp.m4
gl/m4/inet_ntop.m4
gl/m4/inet_pton.m4
gl/m4/memxor.m4
gl/m4/restrict.m4 [deleted file]
gl/snprintf.c

index c2d3995d83dab9d76caa13c2ed077e352bbe72cc..7e6e2afc935496acb21435410ca4c00d41f1c198 100644 (file)
@@ -17,6 +17,7 @@ noinst_LTLIBRARIES = libgnu.la
 libgnu_la_SOURCES =
 libgnu_la_LIBADD = @LTLIBOBJS@
 noinst_HEADERS =
+pkgdata_DATA =
 EXTRA_DIST =
 BUILT_SOURCES =
 SUFFIXES =
index e01ae29d614bc84e7ee51bf45f0e31e6f9befbcd..359b9f12ad54884e8cd72d24d7f801040000877b 100644 (file)
@@ -1,4 +1,4 @@
-# gc.m4 serial 2
+# gc.m4 serial 3
 dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,4 +21,8 @@ AC_DEFUN([gl_GC],
 ])
 
 # Prerequisites of lib/gc.h
-AC_DEFUN([gl_PREREQ_GC], [:])
+AC_DEFUN([gl_PREREQ_GC],
+[
+  AC_REQUIRE([AC_C_RESTRICT])
+  :
+])
index 8d57bb32765d17fdfe2e61789b15ebc2e5abe350..db285d94238641f3eb0fd9e80d6f706536036640 100644 (file)
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 10
+# getaddrinfo.m4 serial 11
 dnl Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -52,7 +52,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
       LIBS="$LIBS -lws2_32"
     fi
     ])
-  AC_REQUIRE([gl_C_RESTRICT])
+  AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_SOCKET_FAMILIES])
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])
   AC_REQUIRE([AC_C_INLINE])
index 8282c984f207bab848a9f893748841684745654e..ddffb12eed0b41c55f2b0c34dc2dc218df9a9f0f 100644 (file)
@@ -19,6 +19,8 @@
 # any checks for libraries, header files, types and library functions.
 AC_DEFUN([gl_EARLY],
 [
+  m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
+  m4_pattern_allow([^gl_ES$])dnl a valid locale name
   AC_REQUIRE([AC_PROG_RANLIB])
   AC_REQUIRE([AC_GNU_SOURCE])
   AC_REQUIRE([gl_LOCK])
@@ -59,7 +61,6 @@ AC_DEFUN([gl_INIT],
   gl_HEADER_NETINET_IN
   gl_FUNC_READ_FILE
   gl_FUNC_READLINE
-  gl_C_RESTRICT
   gl_SIZE_MAX
   gl_FUNC_SNPRINTF
   gl_TYPE_SOCKLEN_T
@@ -208,7 +209,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/progtest.m4
   m4/read-file.m4
   m4/readline.m4
-  m4/restrict.m4
   m4/rijndael.m4
   m4/sha1.m4
   m4/signed.m4
index 5eec8692e7bc924d017f053fd8723c63e1f9b707..bb02d2298b9ad34079228dee5a4ccfabe07a1fdc 100644 (file)
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 2
+# inet_ntop.m4 serial 3
 dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,4 +15,5 @@ AC_DEFUN([gl_PREREQ_INET_NTOP], [
   AC_CHECK_HEADERS_ONCE([netinet/in.h arpa/inet.h])
   AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
   AC_REQUIRE([gl_SOCKET_FAMILIES])
+  AC_REQUIRE([AC_C_RESTRICT])
 ])
index dd8c31854d118defee9431e61390ac8fdb7e73fd..85e802c8bd643a063682a35f7b25be14301ed8fa 100644 (file)
@@ -1,4 +1,4 @@
-# inet_pton.m4 serial 1
+# inet_pton.m4 serial 2
 dnl Copyright (C) 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,4 +15,5 @@ AC_DEFUN([gl_PREREQ_INET_PTON], [
   AC_CHECK_HEADERS_ONCE([netinet/in.h arpa/inet.h])
   AC_CHECK_DECLS([inet_pton],,,[#include <arpa/inet.h>])
   AC_REQUIRE([gl_SOCKET_FAMILIES])
+  AC_REQUIRE([AC_C_RESTRICT])
 ])
index 96764cfbf629ef0905be8a7d83a3a9490e5856bd..bf88a410dc07e53cc85701ee8204d7ba16c3084f 100644 (file)
@@ -1,5 +1,5 @@
-# memxor.m4 serial 1
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
+# memxor.m4 serial 2
+dnl Copyright (C) 2006 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.
@@ -8,4 +8,5 @@ AC_DEFUN([gl_MEMXOR],
 [
   AC_LIBSOURCES([memxor.h, memxor.c])
   AC_LIBOBJ([memxor])
+  AC_REQUIRE([AC_C_RESTRICT])
 ])
diff --git a/gl/m4/restrict.m4 b/gl/m4/restrict.m4
deleted file mode 100644 (file)
index 1f3bbb9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#serial 1003
-dnl Copyright (C) 2003 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.
-
-# This macro can be removed once we can rely on Autoconf 2.57a or later,
-# since we can then use its AC_C_RESTRICT.
-
-# gl_C_RESTRICT
-# --------------
-# Determine whether the C/C++ compiler supports the "restrict" keyword
-# introduced in ANSI C99, or an equivalent.  Do nothing if the compiler
-# accepts it.  Otherwise, if the compiler supports an equivalent,
-# define "restrict" to be that.  Here are some variants:
-# - GCC supports both __restrict and __restrict__
-# - older DEC Alpha C compilers support only __restrict
-# - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
-# Otherwise, define "restrict" to be empty.
-AC_DEFUN([gl_C_RESTRICT],
-[AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict,
-  [gl_cv_c_restrict=no
-   # Try the official restrict keyword, then gcc's __restrict, and
-   # the less common variants.
-   for ac_kw in restrict __restrict __restrict__ _Restrict; do
-     AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-      [float * $ac_kw x;])],
-      [gl_cv_c_restrict=$ac_kw; break])
-   done
-  ])
- case $gl_cv_c_restrict in
-   restrict) ;;
-   no) AC_DEFINE(restrict,,
-       [Define to equivalent of C99 restrict keyword, or to nothing if this
-       is not supported.  Do not define if restrict is supported directly.]) ;;
-   *)  AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;;
- esac
-])
index e019fcece7454e41f37b843bcf6c0365be16e1fd..1018fb4a0f8a73851b296e729f456054bec5d571 100644 (file)
@@ -1,6 +1,6 @@
 /* Formatted output to strings.
-   Copyright (C) 2004 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+   Written by Simon Josefsson and Paul Eggert.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
 
 #include "snprintf.h"
 
+#include <errno.h>
+#include <limits.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "minmax.h"
 #include "vasnprintf.h"
 
+/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW.  */
+#ifndef EOVERFLOW
+# define EOVERFLOW E2BIG
+#endif
+
 /* Print formatted output to string STR.  Similar to sprintf, but
    additional length SIZE limit how much is written into STR.  Returns
    string length of formatted string (which may be larger than SIZE).
@@ -39,22 +45,34 @@ snprintf (char *str, size_t size, const char *format, ...)
 {
   char *output;
   size_t len;
+  size_t lenbuf = size;
   va_list args;
 
   va_start (args, format);
-  len = size;
-  output = vasnprintf (str, &len, format, args);
+  output = vasnprintf (str, &lenbuf, format, args);
+  len = lenbuf;
   va_end (args);
 
   if (!output)
     return -1;
 
-  if (str != NULL)
-    if (len > size - 1) /* equivalent to: (size > 0 && len >= size) */
-      str[size - 1] = '\0';
-
   if (output != str)
-    free (output);
+    {
+      if (size)
+       {
+         size_t pruned_len = (len < size ? len : size - 1);
+         memcpy (str, output, pruned_len);
+         str[pruned_len] = '\0';
+       }
+
+      free (output);
+    }
+
+  if (INT_MAX < len)
+    {
+      errno = EOVERFLOW;
+      return -1;
+    }
 
   return len;
 }