summaryrefslogtreecommitdiffstats
path: root/include/xalloc.h
Commit message (Collapse)AuthorAgeFilesLines
* include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attributeSami Kerola2019-07-141-4/+2Star
| | | | | | | Turned out lsblk is passing null as argument to xstrdup(), so fix that and add assert() to make sure promise of not returning null is kept in future. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: add no return function attributeSami Kerola2019-02-181-1/+2
| | | | | | | | | This warning is repeated 112 times when compiling with all warnings. xalloc.h:23:1: warning: function '__err_oom' could be declared with attribute 'noreturn' [-Wmissing-noreturn] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/c: use returns_nonnull function attribute in xalloc.hSami Kerola2018-11-211-5/+7
| | | | | | | | Let the compiler optimize based on the knowledge that the return value will never be null. Reference: https://patchwork.ozlabs.org/patch/281112/#631159 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/xalloc: add err_oom()Karel Zak2015-07-201-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* silence compiler warningRainer Gerhards2015-03-101-1/+2
| | | | | This is primarily cosmetic, albeit it also provides an only very slight improvement in compile time error checking.
* include/xalloc: add xvasprintf()Karel Zak2014-03-111-0/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/xalloc: add warn_unused_result to allocation functionsKarel Zak2013-07-091-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/xalloc: add xstrndup()Karel Zak2013-04-101-0/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/xalloc: fix mamory leak in xgethostname() [coverity scan]Karel Zak2013-03-271-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/xalloc: add xgethostname()Karel Zak2012-10-191-0/+15
| | | | | | | The new function allocates memory by xalloc() for hostname and fill in the buffer by gethostname(). Signed-off-by: Karel Zak <kzak@redhat.com>
* include: define format to be constant in xasprintf()Sami Kerola2012-07-261-1/+2
| | | | | | Add also format function attribute to add robustness. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: add asprintf wrapperSami Kerola2012-03-181-0/+11
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include,xalloc: fix whitespace to be consistentDave Reisner2011-09-301-7/+7
| | | | | | | We use spaces for the rest of this file, so the random tabs within xstrdup stand out. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* include,xalloc: check for NULL before calling strdupDave Reisner2011-09-301-2/+7
| | | | | | | | | This fixes a segfault in mount (and possibly elsewhere) when invoked without a -t parameter. Broken in 7ef9fd7 when the common xalloc.h libs were introduced. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* include: [xalloc.h]: mention strdup in the file descriptionPetr Uzel2011-02-211-1/+1
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+0Star
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* include: [xalloc.h] include string.hMarek Polacek2011-02-071-0/+1
| | | | | | | xalloc.h needs string.h for declaration of strdup(). Otherwise we can get implicit declaration warning. This patch prevents it. Signed-off-by: Marek Polacek <mpolacek@redhat.com>
* include: [c.h] add fallback for alloc_size attributesKarel Zak2011-02-071-3/+5
| | | | | Reported-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [xalloc] don't use hardcoded return codeKarel Zak2011-01-231-4/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [xalloc] add xstrdup()Karel Zak2010-11-241-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* xalloc: general purpose memory allocation handling wrappersDavidlohr Bueso2010-10-211-0/+46
[kzak@redhat.com: - use %zu for size_t] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>