lib/xalloc.h


Log

Author Commit Date CI Message
Jim Meyering 1602f0af 2012-01-01T10:04:58 maint: update all copyright year number ranges Run "make update-copyright".
Paul Eggert 94122ae4 2011-07-31T12:50:12 * lib/xalloc.h (DEFAULT_MXFAST): Track 64-bit glibc. This is a performance improvement for 64-bit hosts: it causes the value of DEFAULT_MXFAST to track what's in glibc on such hosts.
Paul Eggert 4b69a607 2011-07-12T01:16:08 stdnoreturn, stdnoreturn-tests: remove modules They're not needed here and a bit premature for use elsewhere. See <http://lists.gnu.org/archive/html/bug-gnulib/2011-07/msg00209.html>. * m4/stdnoreturn.m4, modules/stdnoreturn, modules/stdnoreturn-tests: * tests/test-stdnoreturn.c: Remove files. * MODULES.html.sh (_Noreturn <stdnoreturn.h>): Remove section. * lib/openat.h, lib/sigpipe-die.h, lib/xalloc.h, lib/xmemdup0.h: * lib/xstrtol.h: Use _Noreturn rather than including <stdnoreturn.h> and using noreturn. * modules/openat, modules/sigpipe-die, modules/xalloc: * modules/xmemdup0, modules/xstrtol: Remove dependency on stdnoreturn.
Paul Eggert a046525c 2011-07-12T01:11:41 xalloc: use stdnoreturn.h * lib/xalloc.h: Include <stdnoreturn.h>. (_GL_ATTRIBUTE_NORETURN): Remove; all uses replaced with noreturn. * modules/xalloc (Depends-on): Add stdnoreturn.
Eric Blake bf18c9b4 2011-04-27T15:54:30 xalloc-oversized: new module Due to inline functions, mere inclusion of xalloc.h can result in a link dependency on xalloc_die() on some platforms. However, there are several modules that want to use just xalloc_oversized in order to short-circuit the potential to call xalloc_die. Splitting the macro into a new header and module makes this easy. * modules/xalloc-oversized: New module. * modules/xalloc (Depends-on): Add it. * lib/xalloc.h (xalloc_oversized): Move... * lib/xalloc-oversized.h: ...into new file. Signed-off-by: Eric Blake <eblake@redhat.com>
Bruno Haible 59b191ed 2011-02-13T23:44:28 Consistent macro naming for macros that use GCC __attribute__. * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Renamed from _ATTRIBUTE_NONNULL_. * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Likewise. * lib/hash.h (_GL_ATTRIBUTE_WUR): Renamed from ATTRIBUTE_WUR. * lib/ignore-value.h (_GL_ATTRIBUTE_DEPRECATED): Renamed from ATTRIBUTE_DEPRECATED. * lib/openat.h (_GL_ATTRIBUTE_NORETURN): Renamed from ATTRIBUTE_NORETURN. * lib/sigpipe-die.h (_GL_ATTRIBUTE_NORETURN): Likewise. * lib/xmemdup0.h (_GL_ATTRIBUTE_NORETURN): Likewise. * lib/xstrtol.h (_GL_ATTRIBUTE_NORETURN): Likewise. * lib/xalloc.h (_GL_ATTRIBUTE_NORETURN): Likewise. (_GL_ATTRIBUTE_MALLOC): Renamed from ATTRIBUTE_MALLOC. (_GL_ATTRIBUTE_ALLOC_SIZE): Renamed from ATTRIBUTE_ALLOC_SIZE. * lib/version-etc.h (_GL_ATTRIBUTE_SENTINEL): Renamed from ATTRIBUTE_SENTINEL. * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Renamed from ATTRIBUTE_RETURN_CHECK. * tests/test-ignore-value.c (_GL_ATTRIBUTE_RETURN_CHECK): Likewise. * tests/test-argmatch.c (_GL_ATTRIBUTE_NORETURN): Renamed from ATTRIBUTE_NORETURN. * tests/test-exclude.c (_GL_ATTRIBUTE_NORETURN): Likewise. Reported by Paul Eggert.
Bruno Haible f6a5a124 2011-02-13T23:21:20 Don't interfere with a program's definition of __attribute__. * lib/argp.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (argp_error, __argp_error, argp_failure, __argp_failure): Use it. * lib/argp-fmtstream.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (__argp_fmtstream_printf, argp_fmtstream_printf): Use it. * lib/argp-help.c (hol_entry_long_iterate): Use __attribute__ only for GCC 3 or newer. * lib/error.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (error, error_at_line): Use it. * lib/hash.h (__attribute__): Remove definition. (ATTRIBUTE_WUR): Update definition. Define always. * lib/openat.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/sigpipe-die.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/vasnprintf.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (asnprintf, vasnprintf): Use it. * lib/xalloc.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. (ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE): Define always. * lib/xmemdup0.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/xprintf.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (xprintf, xvprintf, xfprintf, xvfprintf): Use it. * lib/xstrtol.h (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * lib/xvasprintf.h (__attribute__): Remove definition. (_GL_ATTRIBUTE_FORMAT): New macro. (xasprintf, xvasprintf): Use it. * tests/test-argmatch.c (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. * tests/test-exclude.c (__attribute__): Remove definition. (ATTRIBUTE_NORETURN): Update definition. Define always. Reported by Paul Eggert.
Jim Meyering d60f3b0c 2011-01-01T20:17:23 maint: update almost all copyright ranges to include 2011 Run the new "make update-copyright" rule.
Bruno Haible f3854f3e 2010-10-17T16:04:04 Make use of GCC's attribute __alloc_size__. * lib/xalloc.h (ATTRIBUTE_ALLOC_SIZE): New macro. (xmalloc, xzalloc, xcalloc, xrealloc, xmemdup, xnmalloc, xnrealloc, xcharalloc): Declare with ATTRIBUTE_ALLOC_SIZE. * lib/eealloc.h (eemalloc, eerealloc): Declare with attribute __alloc_size__. * lib/pagealign_alloc.h (pagealign_alloc, pagealign_xalloc): Likewise. Suggested by Jim Meyering.
Jim Meyering 28e6fc0a 2010-01-05T15:10:02 xalloc.h: use consistent formatting * lib/xalloc.h: Move declarations to start in the first column.
Jim Meyering b2e2010c 2010-01-01T10:31:12 update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
Jim Meyering 3030c5b5 2009-12-28T10:50:36 update nearly all FSF copyright year lists to include 2009 The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
Bruno Haible 441aa304 2009-12-10T20:28:30 Use spaces for indentation, not tabs.
Bruno Haible 095b97e5 2008-05-22T00:54:26 Oops, remove stray semicolon added in last commit.
Bruno Haible f64a5d62 2008-05-15T02:01:46 Help GCC to do better code generation.
Eric Blake 929dceba 2008-05-13T21:28:43 Split xmemdup0 into its own module. * modules/xmemdup0: New file. * lib/xmemdup0.h: Likewise. * lib/xmemdup0.c: Likewise. * MODULES.html.sh (Memory management functions): Add xmemdup0. * lib/xalloc.h (xmemdup0): Remove. * lib/xmalloc.c (xmemdup0): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
Eric Blake 34ebad3d 2008-05-09T13:54:18 Add xmemdup0. * lib/xalloc.h (xmemdup0): New prototype and C++ typesafe implementation. * lib/xmalloc.c (xmemdup0): New C implementation. Signed-off-by: Eric Blake <ebb9@byu.net>
Bruno Haible 15834b98 2008-01-13T16:51:48 Don't redefine __attribute__ without a need.
Bruno Haible 57fdfd3f 2007-10-07T19:14:58 Change copyright notice from GPLv2+ to GPLv3+.
Paul Eggert 9d7a0ece 2007-02-04T02:20:40 * lib/xalloc.h (x2nrealloc): Fix an unlikely bug in the overflow checking code. Set N = ceil (1.5 * N) rather than to a slightly larger value. Give tools a better chance to allocate space for very large buffers. * lib/xalloc.h (x2nrealloc): Use 3/2, not 2, as buffer size factor.
Jim Meyering 9dd25cd0 2007-02-01T23:53:04 Give tools a better chance to allocate space for very large buffers. * lib/xalloc.h (x2nrealloc): Use 3/2, not 2, as buffer size factor.
Paul Eggert 8cdbf8e5 2006-11-08T00:22:30 * lib/xalloc.h (XMALLOC, XNMALLOC, XZALLOC, XCALLOC): Move definitions up, to avoid colliding with change below. (static_inline) [HAVE_INLINE]: New macro. (xnmalloc, xnrealloc, x2nrealloc, xcharalloc): Provide extern decls when !HAVE_INLINE. Do not define unless static_inline is defined, either by us or by xmalloc.c. Use static_inline rather than static inline. (XCALLOC): Optimize sizeof(T) = 1 case. * lib/xmalloc.c (static_inline) [!HAVE_INLINE]: New macro. 2006-11-07 Bruno Haible <bruno@clisp.org> * lib/xalloc.h (XNMALLOC): Restore optimization of sizeof(T) = 1 case. * m4/xalloc.m4 (gl_PREREQ_XALLOC): Require gl_INLINE instead of AC_C_INLINE. * modules/xalloc (Files): Add m4/inline.m4.
Paul Eggert ac2a728a 2006-11-06T21:24:35 * lib/xalloc.h (xnmalloc, xnrealloc, x2nrealloc): Now static inline functions that are identical with the old xnmalloc_inline, xnrealloc_inline, x2nrealloc_inline of lib/xmalloc.c. This is so that we can avoid some unnecessary integer multiplications and divisions in the common case where the element size is known at compile time. (XNMALLOC) [HAVE_INLINE]: Remove special case, which is no longer needed. (xnboundedmalloc): Remove. (XMALLOC, XNMALLOC, XZALLOC, XCALLOC): Use lower-case letters for arguments, for consistency with rest of this header. (xcharalloc): Rewrite using XNMALLOC. * lib/xmalloc.c (xnmalloc_inline, xnmalloc, xnrealloc_inline): (xnrealloc, x2nrealloc_inline, x2nrealloc): Remove. The *_inline versions have been moved to lib/xalloc.h and renamed to be the non-*_inline versions. (xmalloc, xrealloc): Implement without reference to the xnmalloc and xnrealloc functions, since those functions are now inline and now call us. (x2realloc): Invoke x2realloc, not x2realloc_inline, to accommodate renaming described above.
Bruno Haible 7c6d5072 2006-11-06T13:03:10 Simplify xmalloc expressions. Add overflow check in xmalloc arguments.
Paul Eggert 08262434 2006-10-31T21:51:45 Avoid some C++ diagnostics reported by Bruno Haible. * lib/quotearg.c (clone_quoting_options): Use xmemdup rather than xmalloc. (quotearg_alloc): Use xcharalloc rather than xmalloc. (struct slotvec): Move to top level. (quotearg_n_options): Rewrite to avoid xmalloc. * lib/xalloc.h (xcharalloc): New function. * (xrealloc, xnrealloc, x2realloc, x2nrealloc, xmemdup): [defined __cplusplus]: Add function template that provides result type propagation. This part of the change is from Bruno Haible.
Paul Eggert 267a39ba 2005-05-14T06:03:57 *** empty log message ***
Paul Eggert a0defda0 2004-10-05T06:45:51 Rename xclone to xmemdup. Remove obsolete xalloc macros. Remove xstrdup.c and move xstrdup implementation to xmalloc.c.
Paul Eggert b0cc20c2 2004-08-09T18:31:09 Remove dependency of xalloc in exitfail, error, gettext.
Bruno Haible a0b977a4 2004-07-16T16:28:48 Add extern "C" for C++.
Paul Eggert 346d5dc0 2003-11-13T07:19:08 Remove dependency of xalloc.h on SIZE_MAX and PTRDIFF_MAX.
Bruno Haible 8224e300 2003-11-11T11:58:42 Rely on SIZE_MAX and PTRDIFF_MAX as defined by ISO C 99.
Paul Eggert 17e0f9ee 2003-11-10T23:55:49 Fix off-by-one error in xalloc_oversized.
Paul Eggert 96257537 2003-11-06T19:40:49 Reject allocations of exactly SIZE_MAX bytes.
Paul Eggert fdb6eb33 2003-10-30T06:33:39 Revamp xalloc_oversized so that its count arg need not fit into size_t. Fix up group-member, quotearg accordingly.
Paul Eggert 2250641d 2003-10-27T08:00:26 New function xalloc_oversized.
Paul Eggert 57bc22e6 2003-10-27T07:28:24 Add x2realloc, x2nrealloc. Port to C99 inline.
Paul Eggert e970fbf9 2003-10-13T06:07:10 Revamp xalloc interface so that it can check for address arithmetic overflow.
Paul Eggert 5c7070ea 2003-07-22T22:10:55 Sync with coreutils xalloc.h, xmalloc.c, xmemcoll.h, xmemcoll.c.
Paul Eggert 68af56be 2003-06-18T05:52:19 Assume C89, so PARAMS isn't needed.
Paul Eggert 92295bc4 2003-06-04T19:22:29 .h files should stand alone, but we shouldn't include <sys/types.h> if we can get away with just <stddef.h>.
Jim Meyering f73e8ba6 2000-10-31T07:09:56 Add "2000" to Copyright line, as this file was changed this year.
Jim Meyering 02461019 2000-08-07T17:02:15 (xalloc_msg_memory_exhausted): Now char const[], not char *const and pointing to a constant array.
Jim Meyering 89f2b489 2000-08-07T15:48:18 back out Copyright date changes for files with no changes year
Jim Meyering d349992d 2000-07-09T07:22:43 update copyright date
Jim Meyering 33bf2142 1999-11-09T20:34:17 (XMALLOC): Correct misnamed macro parameter name: s/N_bytes/N_items/. (XCALLOC): Likewise. (XREALLOC): Likewise.
Jim Meyering e5534304 1999-10-04T05:59:37 (__attribute__): Define to empty if GCC claims to be before 2.8; this is needed for OPENStep 4.2 cc. Also, define to empty if strict ANSI.
Jim Meyering f8bf1528 1999-09-28T15:26:45 (__attribute__): Protect against redefinition.
Jim Meyering 9d67945f 1999-09-26T19:01:12 small correction from Akim
Jim Meyering fa2069e4 1999-09-26T18:42:56 (__attribute__): Define. (ATTRIBUTE_NORETURN): Define. (xalloc_fail_func): Add noreturn attribute. (xalloc_die): Declare. (NEW): Define as yet unused macro. (XFREE): Likewise (CCLONE): Likewise. (CLONE): Likewise. From Akim Demaille.
Jim Meyering 5249a0d1 1999-09-02T21:23:01 (xalloc_fail_func): Use `PARAMS'. (xstrdup): Add protoype.
Jim Meyering f9dba3b4 1999-01-01T17:36:43 Add comments. (PARAMS, XMALLOC, XCALLOC, XREALLOC): Define. Based on changes from Akim Demaille.
Jim Meyering 358e52e8 1997-12-21T11:22:51 Use PARAMS, not __P.
Jim Meyering 4c03f9a7 1997-10-25T21:49:45 .