summaryrefslogtreecommitdiff
path: root/lib/xalloc.h
Commit message (Collapse)AuthorAgeFilesLines
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-3/+1
| | | | Run the new "make update-copyright" rule.
* Make use of GCC's attribute __alloc_size__.Bruno Haible2010-10-171-11/+32
| | | | | | | | | | * 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.
* xalloc.h: use consistent formattingJim Meyering2010-01-051-4/+4
| | | | * lib/xalloc.h: Move declarations to start in the first column.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+2
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* update nearly all FSF copyright year lists to include 2009Jim Meyering2009-12-291-2/+2
| | | | | | | | | | | | | | | | | | 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.
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-23/+23
|
* Oops, remove stray semicolon added in last commit.Bruno Haible2008-05-221-1/+1
|
* Help GCC to do better code generation.Bruno Haible2008-05-151-7/+17
|
* Split xmemdup0 into its own module.Eric Blake2008-05-131-7/+0
| | | | | | | | | | | * 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>
* Add xmemdup0.Eric Blake2008-05-091-0/+7
| | | | | | | | * 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>
* Don't redefine __attribute__ without a need.Bruno Haible2008-01-131-2/+2
|
* Change copyright notice from GPLv2+ to GPLv3+.Bruno Haible2007-10-071-5/+4
|
* * lib/xalloc.h (x2nrealloc): Fix an unlikely bug in the overflowPaul Eggert2007-02-041-3/+7
| | | | | | | | 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.
* Give tools a better chance to allocate space for very large buffers.Jim Meyering2007-02-011-7/+7
| | | | * lib/xalloc.h (x2nrealloc): Use 3/2, not 2, as buffer size factor.
* * lib/xalloc.h (XMALLOC, XNMALLOC, XZALLOC, XCALLOC): MovePaul Eggert2006-11-081-27/+45
| | | | | | | | | | | | | | | | | | 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.
* * lib/xalloc.h (xnmalloc, xnrealloc, x2nrealloc): Now staticPaul Eggert2006-11-061-39/+121
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Simplify xmalloc expressions. Add overflow check in xmalloc arguments.Bruno Haible2006-11-061-4/+49
|
* Avoid some C++ diagnostics reported by Bruno Haible.Paul Eggert2006-10-311-0/+43
| | | | | | | | | | | | * 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.
* *** empty log message ***Paul Eggert2005-05-141-1/+1
|
* Rename xclone to xmemdup. Remove obsolete xalloc macros.Paul Eggert2004-10-051-13/+2
| | | | Remove xstrdup.c and move xstrdup implementation to xmalloc.c.
* Remove dependency of xalloc in exitfail, error, gettext.Paul Eggert2004-08-091-13/+3
|
* Add extern "C" for C++.Bruno Haible2004-07-161-1/+14
|
* Remove dependency of xalloc.h on SIZE_MAX and PTRDIFF_MAX.Paul Eggert2003-11-131-13/+3
|
* Rely on SIZE_MAX and PTRDIFF_MAX as defined by ISO C 99.Bruno Haible2003-11-111-3/+7
|
* Fix off-by-one error in xalloc_oversized.Paul Eggert2003-11-101-5/+6
|
* Reject allocations of exactly SIZE_MAX bytes.Paul Eggert2003-11-061-2/+16
|
* Revamp xalloc_oversized so that its count arg need not fit into size_t.Paul Eggert2003-10-301-10/+5
| | | | Fix up group-member, quotearg accordingly.
* New function xalloc_oversized.Paul Eggert2003-10-271-0/+11
|
* Add x2realloc, x2nrealloc. Port to C99 inline.Paul Eggert2003-10-271-0/+2
|
* Revamp xalloc interface so that it can check for address arithmetic overflow.Paul Eggert2003-10-131-23/+15
|
* Sync with coreutils xalloc.h, xmalloc.c, xmemcoll.h, xmemcoll.c.Paul Eggert2003-07-221-11/+6
|
* Assume C89, so PARAMS isn't needed.Paul Eggert2003-06-181-15/+9
|
* .h files should stand alone, but we shouldn't include <sys/types.h>Paul Eggert2003-06-041-0/+2
| | | | if we can get away with just <stddef.h>.
* Add "2000" to Copyright line, as this file was changed this year.Jim Meyering2000-10-311-1/+1
|
* (xalloc_msg_memory_exhausted): Now char const[],Jim Meyering2000-08-071-3/+3
| | | | not char *const and pointing to a constant array.
* back out Copyright date changes for files with no changes yearJim Meyering2000-08-071-1/+1
|
* update copyright dateJim Meyering2000-07-091-1/+1
|
* (XMALLOC): Correct misnamed macro parameter name: s/N_bytes/N_items/.Jim Meyering1999-11-091-4/+4
| | | | | (XCALLOC): Likewise. (XREALLOC): Likewise.
* (__attribute__): Define to empty if GCC claims toJim Meyering1999-10-041-1/+1
| | | | | be before 2.8; this is needed for OPENStep 4.2 cc. Also, define to empty if strict ANSI.
* (__attribute__): Protect against redefinition.Jim Meyering1999-09-281-2/+4
|
* small correction from AkimJim Meyering1999-09-261-2/+2
|
* (__attribute__): Define.Jim Meyering1999-09-261-2/+34
| | | | | | | | | | | (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.
* (xalloc_fail_func): Use `PARAMS'.Jim Meyering1999-09-021-2/+3
| | | | (xstrdup): Add protoype.
* Add comments.Jim Meyering1999-01-011-11/+42
| | | | | (PARAMS, XMALLOC, XCALLOC, XREALLOC): Define. Based on changes from Akim Demaille.
* Use PARAMS, not __P.Jim Meyering1997-12-211-5/+6
|
* .Jim Meyering1997-10-251-0/+20