lib/xmalloc.c


Log

Author Commit Date CI Message
Jim Meyering f93bd98a 2009-03-12T13:09:42 avoid gcc warnings about unused macro definitions * lib/readtokens.c (STREQ): Remove unused definition. * lib/xmalloc.c (SIZE_MAX): Likewise. * lib/openat-die.c (N_): Likewise. * lib/mountlist.c (SIZE_MAX): Remove definition. Instead, include <stdint.h>. * lib/readutmp.c: Likewise. * modules/readutmp (Depends-on): Add stdint. * modules/mountlist (Depends-on): Add stdint. * lib/userspec.c (ISDIGIT): Move definition into #if block where used.
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 57fdfd3f 2007-10-07T19:14:58 Change copyright notice from GPLv2+ to GPLv3+.
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.
Paul Eggert 0632e115 2006-09-13T22:38:14 * _fpending.c: Include <config.h> unconditionally, since we no longer worry about uses that don't define HAVE_CONFIG_H. * acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c: * basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c: * canonicalize.c, chdir-long.c, chdir-safer.c, chown.c: * cloexec.c, close-stream.c, closeout.c, creat-safer.c: * cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c: * dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c: * exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c: * file-type.c, fileblocks.c, filemode.c, filenamecat.c: * fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c: * ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c: * getcwd.c, getdate.y, getdomainname.c, getgroups.c: * gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c: * getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c: * gettime.c, gettimeofday.c, getugroups.c, getusershell.c: * glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c: * human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c: * isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c: * malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c: * memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c: * mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c: * mountlist.c, nanosleep.c, obstack.c, open-safer.c: * openat-die.c, openat.c, pagealign_alloc.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c: * same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c: * sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c: * stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c: * strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c: * timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c: * utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c: * xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c: * xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c: * xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Likewise.
Paul Eggert 222b0486 2005-09-19T17:28:14 Use a consistent style for including <config.h>. * __fpending.c, acl.c, argmatch.c, argp-help.c, argp-parse.c, argp-pvh.c, backupfile.c, basename.c, c-stack.c, calloc.c, check-version.c, cloexec.c, closeout.c, copy-file.c, creat-safer.c, cycle-check.c, dirfd.c, dirname.c, dup-safer.c, dup2.c, euidaccess.c, exclude.c, exitfail.c, fatal-signal.c, fd-safer.c, file-type.c, fileblocks.c, filemode.c, filenamecat.c, findprog.c, fnmatch.c, fopen-safer.c, free.c, fsusage.c, ftruncate.c, full-write.c, fwriteerror.c, getaddrinfo.c, getcwd.c, getdelim.c, getline.c, getlogin_r.c, getndelim2.c, getnline.c, getopt1.c, getpass.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c, human.c, idcache.c, inet_ntop.c, isdir.c, long-options.c, malloc.c, memcasecmp.c, memcmp.c, memcoll.c, memcpy.c, memmove.c, mkdir-p.c, modechange.c, mountlist.c, open-safer.c, physmem.c, pipe-safer.c, pipe.c, poll.c, posixver.c, progname.c, progreloc.c, putenv.c, quote.c, quotearg.c, readline.c, readlink.c, realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c, same.c, save-cwd.c, savedir.c, sig2str.c, strcspn.c, strerror.c, stripslash.c, strncasecmp.c, strndup.c, strnlen.c, strnlen1.c, strsep.c, strstr.c, strtod.c, strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c, userspec.c, utimecmp.c, version-etc-fsf.c, version-etc.c, wait-process.c, xalloc-die.c, xgetcwd.c, xmalloc.c, xmemcoll.c, xnanosleep.c, xreadlink.c, xsetenv.c, xstrndup.c, xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Standardize inclusion of config.h. * __fpending.h, dirfd.h, getdate.h, human.h, inttostr.h: Removed inclusion of config.h from header files. * inttostr.c: Adjusted in-tree users. * timespec.h: Remove superfluous warning to include config.h. * atexit.c, chdir-long.c chown.c, fchown-stub.c, getgroups.c, gettimeofday.c, lchown.c, lstat.c, mkdir.c, mkstemp.c, nanosleep.c, openat.c, raise.c, readtokens0.c, readutmp.c, unlinkdir.c: Guard inclusion of config.h with HAVE_CONFIG_H.
Paul Eggert cd90feb3 2005-06-22T07:12:04 * xmalloc.c (HAVE_GNU_CALLOC): New constant. (xcalloc): Use it to avoid needless tests.
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.
Paul Eggert 8551f7ed 2004-06-01T03:49:45 Remove dependency of hash and xalloc modules on the malloc and realloc modules.
Jim Meyering 9e03434d 2003-11-22T15:07:36 (x2nrealloc_inline): Fix typos in comments: s/size/size_t/.
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.
Jim Meyering 28d52bab 2003-10-16T07:06:25 Include <string.h>, for declarations of memset and memcpy.
Paul Eggert e970fbf9 2003-10-13T06:07:10 Revamp xalloc interface so that it can check for address arithmetic overflow.
Paul Eggert 1d31a1e7 2003-09-12T20:14:10 Use "exit.h" rather than rolling EXIT_FAILURE ourselves in each module.
Paul Eggert fa9635f2 2003-09-12T18:24:51 Remove K&R cruft.
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.
Bruno Haible 9b87e4e1 2002-11-21T19:16:29 Comment tweaks.
Jim Meyering 93f20861 2002-11-21T08:43:42 Adjust to work with new autoconf macros, AC_FUNC_MALLOC and AC_FUNC_REALLOC: test #ifndef HAVE_MALLOC/HAVE_REALLOC.
Bruno Haible f9fa25dc 2002-11-05T21:45:29 Include gettext.h instead of <libintl.h> with #ifdefs.
Jim Meyering 526408f4 2001-01-26T11:13:28 [HAVE_DONE_WORKING_MALLOC_CHECK]: Enclose error-evoking line in double quotes so that it evokes a better diagnostic. [HAVE_DONE_WORKING_REALLOC_CHECK]: Likewise.
Jim Meyering 00d29cc3 2000-08-07T17:06:38 (xalloc_msg_memory_exhausted): Now char const[], not char *const and pointing to a constant array. (xrealloc): Comment fix.
Jim Meyering 40c60144 2000-07-31T06:44:51 Use `virtual memory exhausted', not `Memory exhausted'.
Jim Meyering d349992d 2000-07-09T07:22:43 update copyright date
Jim Meyering 757bb587 1999-09-26T19:05:39 (xalloc_die): Rename from xalloc_fail and update callers. Use explicit exit to help avoid warnings.
Jim Meyering 501a5df5 1999-09-01T13:09:19 (xalloc_fail_func): Use `PARAMS'.
Jim Meyering 34e6caa6 1999-04-18T23:17:05 (xalloc_fail): Pass xalloc_msg_memory_exhausted through gettext.
Jim Meyering c073723b 1999-03-08T02:43:14 (xalloc_fail): Use "%s" format so the message doesn't have to be scanned for % signs. Suggestion from François Pinard.
Jim Meyering 21e75a37 1999-01-01T17:40:08 Add comments. (xcalloc, xmalloc, xrealloc): Remove prototypes. (calloc): Remove `#ifdef NOT_USED' that used to hide this function.
Jim Meyering cf42d3e5 1998-12-07T03:12:10 ansideclify
Jim Meyering 267a5986 1997-11-15T17:18:01 remove fixup_null_alloc prototype
Jim Meyering 4d73296d 1997-11-03T15:19:20 make sure autoconf tests have been run
Jim Meyering 7b300269 1997-11-03T05:25:44 (xalloc_fail): Renamed from fixup_null_alloc. (xcalloc): #ifdef-out unused function. (xrealloc): Remove code to work around deficient versions of realloc. Now we have an autoconf-enabled replacement version. (xmalloc): Remove code to work around deficient versions of malloc. Now we have an autoconf-enabled replacement version.
Jim Meyering 373d33b1 1997-10-26T04:39:53 (xalloc_fail_func): Initialize to 0, not NULL.
Jim Meyering 2753afe5 1997-10-25T21:51:21 Include xalloc.h. Change VOID to void. (xalloc_exit_failure): Renamed extern. (xalloc_msg_memory_exhausted): New extern. (xalloc_fail_func): New extern. (fixup_null_alloc): Use new variables.
Jim Meyering 8bc2863c 1996-10-17T01:58:19 libitize
Jim Meyering 783c1624 1996-07-15T03:56:06 indent cpp-directives
Jim Meyering 37f27c1b 1996-07-15T02:41:49 update FSF address in copyright and remove any trailing blanks
Jim Meyering cb0e9ba1 1995-03-20T15:09:56 sync from FSF
Jim Meyering 43e78b97 1992-11-01T05:44:30 Initial revision