diff options
author | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-04-04 23:59:51 +0900 |
---|---|---|
committer | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-04-04 23:59:51 +0900 |
commit | 7311a3ea25980c98307156bb16cf9a31b9228473 (patch) | |
tree | d36d9974af4ce083fa4dece5bdcb3eea7883190e /jni/iconv/gnulib-local/lib | |
parent | 08b3c31dd0d0b12d63673691da72a40ae108a0d9 (diff) |
mkxp fixes
Diffstat (limited to 'jni/iconv/gnulib-local/lib')
-rw-r--r-- | jni/iconv/gnulib-local/lib/alloca.in.h | 68 | ||||
-rw-r--r-- | jni/iconv/gnulib-local/lib/error.h.diff | 33 | ||||
-rw-r--r-- | jni/iconv/gnulib-local/lib/progname.h.diff | 19 | ||||
-rw-r--r-- | jni/iconv/gnulib-local/lib/xalloc.h | 158 | ||||
-rw-r--r-- | jni/iconv/gnulib-local/lib/xmalloc.c | 128 | ||||
-rw-r--r-- | jni/iconv/gnulib-local/lib/xstrdup.c | 40 |
6 files changed, 0 insertions, 446 deletions
diff --git a/jni/iconv/gnulib-local/lib/alloca.in.h b/jni/iconv/gnulib-local/lib/alloca.in.h deleted file mode 100644 index 964cb8d..0000000 --- a/jni/iconv/gnulib-local/lib/alloca.in.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2007 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/>. */ - -/* When this file is included, it may be preceded only by preprocessor - declarations. Thanks to AIX. Therefore we include it right after - "config.h", not later. */ - -/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H - means there is a real alloca function. */ -#ifndef _GL_ALLOCA_H -#define _GL_ALLOCA_H - -/* alloca(N) returns a pointer (void* or char*) to N bytes of memory - allocated on the stack, and which will last until the function returns. - Use of alloca should be avoided: - - inside arguments of function calls - undefined behaviour, - - in inline functions - the allocation may actually last until the - calling function returns, - - for huge N (say, N >= 65536) - you never know how large (or small) - the stack is, and when the stack cannot fulfill the memory allocation - request, the program just crashes. - */ - -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# else -# ifdef _MSC_VER -# include <malloc.h> -# define alloca _alloca -# else -# if HAVE_ALLOCA_H -# include <alloca.h> -# else -# ifdef _AIX - #pragma alloca -# else -# ifdef __hpux /* This section must match that of bison generated files. */ -# ifdef __cplusplus -extern "C" void *alloca (unsigned int); -# else /* not __cplusplus */ -extern void *alloca (); -# endif /* not __cplusplus */ -# else /* not __hpux */ -# ifndef alloca -extern char *alloca (); -# endif -# endif /* __hpux */ -# endif -# endif -# endif -# endif -#endif - -#endif /* _GL_ALLOCA_H */ diff --git a/jni/iconv/gnulib-local/lib/error.h.diff b/jni/iconv/gnulib-local/lib/error.h.diff deleted file mode 100644 index 069df8d..0000000 --- a/jni/iconv/gnulib-local/lib/error.h.diff +++ /dev/null @@ -1,33 +0,0 @@ -*** gnulib/lib/error.h 2005-05-14 08:03:58.000000000 +0200 ---- srclib/error.h 2005-05-20 23:06:02.000000000 +0200 -*************** -*** 50,63 **** - /* If NULL, error will flush stdout, then print on stderr the program - name, a colon and a space. Otherwise, error will call this - function without parameters instead. */ -! extern void (*error_print_progname) (void); - - /* This variable is incremented each time `error' is called. */ -! extern unsigned int error_message_count; - - /* Sometimes we want to have at most one error per line. This - variable controls whether this mode is selected or not. */ -! extern int error_one_per_line; - - #ifdef __cplusplus - } ---- 50,63 ---- - /* If NULL, error will flush stdout, then print on stderr the program - name, a colon and a space. Otherwise, error will call this - function without parameters instead. */ -! extern DLL_VARIABLE void (*error_print_progname) (void); - - /* This variable is incremented each time `error' is called. */ -! extern DLL_VARIABLE unsigned int error_message_count; - - /* Sometimes we want to have at most one error per line. This - variable controls whether this mode is selected or not. */ -! extern DLL_VARIABLE int error_one_per_line; - - #ifdef __cplusplus - } diff --git a/jni/iconv/gnulib-local/lib/progname.h.diff b/jni/iconv/gnulib-local/lib/progname.h.diff deleted file mode 100644 index 37dda97..0000000 --- a/jni/iconv/gnulib-local/lib/progname.h.diff +++ /dev/null @@ -1,19 +0,0 @@ -*** gnulib/lib/progname.h 2005-05-14 08:03:58.000000000 +0200 ---- srclib/progname.h 2005-05-20 23:06:02.000000000 +0200 -*************** -*** 30,36 **** - - - /* String containing name the program is called with. */ -! extern const char *program_name; - - /* Set program_name, based on argv[0]. */ - extern void set_program_name (const char *argv0); ---- 30,36 ---- - - - /* String containing name the program is called with. */ -! extern DLL_VARIABLE const char *program_name; - - /* Set program_name, based on argv[0]. */ - extern void set_program_name (const char *argv0); diff --git a/jni/iconv/gnulib-local/lib/xalloc.h b/jni/iconv/gnulib-local/lib/xalloc.h deleted file mode 100644 index e0d56fc..0000000 --- a/jni/iconv/gnulib-local/lib/xalloc.h +++ /dev/null @@ -1,158 +0,0 @@ -/* malloc with out of memory checking. - Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. - Written by Bruno Haible <haible@clisp.cons.org>, 2001. - - 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/>. */ - -#ifndef _XALLOC_H -#define _XALLOC_H - -#include <stddef.h> - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Defined in xmalloc.c. */ - -/* Allocate SIZE bytes of memory dynamically, with error checking. */ -extern void *xmalloc (size_t size); - -/* Allocate memory for NMEMB elements of SIZE bytes, with error checking. - SIZE must be > 0. */ -extern void *xnmalloc (size_t nmemb, size_t size); - -/* Allocate SIZE bytes of memory dynamically, with error checking, - and zero it. */ -extern void *xzalloc (size_t size); - -/* Allocate memory for NMEMB elements of SIZE bytes, with error checking, - and zero it. */ -extern void *xcalloc (size_t nmemb, size_t size); - -/* Change the size of an allocated block of memory PTR to SIZE bytes, - with error checking. If PTR is NULL, run xmalloc. */ -extern void *xrealloc (void *ptr, size_t size); -#ifdef __cplusplus -} -template <typename T> - inline T * xrealloc (T * ptr, size_t size) - { - return (T *) xrealloc ((void *) ptr, size); - } -extern "C" { -#endif - -/* This function is always triggered when memory is exhausted. It is - in charge of honoring the three previous items. This is the - function to call when one wants the program to die because of a - memory allocation failure. */ -extern void xalloc_die (void) -#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) && !__STRICT_ANSI__ - __attribute__ ((__noreturn__)) -#endif - ; - -/* In the following macros, T must be an elementary or structure/union or - typedef'ed type, or a pointer to such a type. To apply one of the - following macros to a function pointer or array type, you need to typedef - it first and use the typedef name. */ - -/* Allocate an object of type T dynamically, with error checking. */ -/* extern T *XMALLOC (typename T); */ -#define XMALLOC(T) \ - ((T *) xmalloc (sizeof (T))) - -/* Allocate memory for NMEMB elements of type T, with error checking. */ -/* extern T *XNMALLOC (size_t nmemb, typename T); */ -#if HAVE_INLINE -/* xnmalloc performs a division and multiplication by sizeof (T). Arrange to - perform the division at compile-time and the multiplication with a factor - known at compile-time. */ -# define XNMALLOC(N,T) \ - ((T *) (sizeof (T) == 1 \ - ? xmalloc (N) \ - : xnboundedmalloc(N, (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / sizeof (T), sizeof (T)))) -static inline void * -xnboundedmalloc (size_t n, size_t bound, size_t s) -{ - if (n > bound) - xalloc_die (); - return xmalloc (n * s); -} -#else -# define XNMALLOC(N,T) \ - ((T *) (sizeof (T) == 1 ? xmalloc (N) : xnmalloc (N, sizeof (T)))) -#endif - -/* Allocate an object of type T dynamically, with error checking, - and zero it. */ -/* extern T *XZALLOC (typename T); */ -#define XZALLOC(T) \ - ((T *) xzalloc (sizeof (T))) - -/* Allocate memory for NMEMB elements of type T, with error checking, - and zero it. */ -/* extern T *XCALLOC (size_t nmemb, typename T); */ -#define XCALLOC(N,T) \ - ((T *) xcalloc (N, sizeof (T))) - -/* Return a pointer to a new buffer of N bytes. This is like xmalloc, - except it returns char *. */ -#define xcharalloc(N) \ - XNMALLOC (N, char) - - -/* Defined in xstrdup.c. */ - -/* Return a newly allocated copy of the N bytes of memory starting at P. */ -extern void *xmemdup (const void *p, size_t n); -#ifdef __cplusplus -} -template <typename T> - inline T * xmemdup (const T * p, size_t n) - { - return (T *) xmemdup ((const void *) p, n); - } -extern "C" { -#endif - -/* Return a newly allocated copy of STRING. */ -extern char *xstrdup (const char *string); - - -/* Return 1 if an array of N objects, each of size S, cannot exist due - to size arithmetic overflow. S must be positive and N must be - nonnegative. This is a macro, not an inline function, so that it - works correctly even when SIZE_MAX < N. - - By gnulib convention, SIZE_MAX represents overflow in size - calculations, so the conservative dividend to use here is - SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. - However, malloc (SIZE_MAX) fails on all known hosts where - sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for - exactly-SIZE_MAX allocations on such hosts; this avoids a test and - branch when S is known to be 1. */ -# define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) - - -#ifdef __cplusplus -} -#endif - - -#endif /* _XALLOC_H */ diff --git a/jni/iconv/gnulib-local/lib/xmalloc.c b/jni/iconv/gnulib-local/lib/xmalloc.c deleted file mode 100644 index d2a1214..0000000 --- a/jni/iconv/gnulib-local/lib/xmalloc.c +++ /dev/null @@ -1,128 +0,0 @@ -/* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-1996, 2000-2003, 2005-2007 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/>. */ - -#include <config.h> - -/* Specification. */ -#include "xalloc.h" - -#include <stdlib.h> - -#include "error.h" -#include "gettext.h" - -#define _(str) gettext (str) - - -/* Exit value when the requested amount of memory is not available. - The caller may set it to some other value. */ -int xmalloc_exit_failure = EXIT_FAILURE; - -void -xalloc_die () -{ - error (xmalloc_exit_failure, 0, _("memory exhausted")); - /* The `noreturn' cannot be given to error, since it may return if - its first argument is 0. To help compilers understand the - xalloc_die does terminate, call exit. */ - exit (EXIT_FAILURE); -} - -static void * -fixup_null_alloc (size_t n) -{ - void *p; - - p = NULL; - if (n == 0) - p = malloc ((size_t) 1); - if (p == NULL) - xalloc_die (); - return p; -} - -/* Allocate N bytes of memory dynamically, with error checking. */ - -void * -xmalloc (size_t n) -{ - void *p; - - p = malloc (n); - if (p == NULL) - p = fixup_null_alloc (n); - return p; -} - -/* Allocate memory for NMEMB elements of SIZE bytes, with error checking. - SIZE must be > 0. */ - -void * -xnmalloc (size_t nmemb, size_t size) -{ - size_t n; - void *p; - - if (xalloc_oversized (nmemb, size)) - xalloc_die (); - n = nmemb * size; - p = malloc (n); - if (p == NULL) - p = fixup_null_alloc (n); - return p; -} - -/* Allocate SIZE bytes of memory dynamically, with error checking, - and zero it. */ - -void * -xzalloc (size_t size) -{ - void *p; - - p = xmalloc (size); - memset (p, 0, size); - return p; -} - -/* Allocate memory for N elements of S bytes, with error checking, - and zero it. */ - -void * -xcalloc (size_t n, size_t s) -{ - void *p; - - p = calloc (n, s); - if (p == NULL) - p = fixup_null_alloc (n); - return p; -} - -/* Change the size of an allocated block of memory P to N bytes, - with error checking. - If P is NULL, run xmalloc. */ - -void * -xrealloc (void *p, size_t n) -{ - if (p == NULL) - return xmalloc (n); - p = realloc (p, n); - if (p == NULL) - p = fixup_null_alloc (n); - return p; -} diff --git a/jni/iconv/gnulib-local/lib/xstrdup.c b/jni/iconv/gnulib-local/lib/xstrdup.c deleted file mode 100644 index 9ad1b94..0000000 --- a/jni/iconv/gnulib-local/lib/xstrdup.c +++ /dev/null @@ -1,40 +0,0 @@ -/* xstrdup.c -- copy a string with out of memory checking - Copyright (C) 1990, 1996, 2000-2003, 2005-2006 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/>. */ - -#include <config.h> - -/* Specification. */ -#include "xalloc.h" - -#include <string.h> - -/* Return a newly allocated copy of the N bytes of memory starting at P. */ - -void * -xmemdup (const void *p, size_t n) -{ - void *q = xmalloc (n); - memcpy (q, p, n); - return q; -} - -/* Return a newly allocated copy of STRING. */ - -char * -xstrdup (const char *string) -{ - return strcpy (XNMALLOC (strlen (string) + 1, char), string); -} |