lib/xalloc.h


Log

Author Commit Date CI Message
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 .