summaryrefslogtreecommitdiffstats
path: root/lib/xfuncs.c
Commit message (Collapse)AuthorAgeFilesLines
* xfuncs: fix format specifier in pr_emerg callIan Abbott2017-05-171-1/+1
| | | | | | | | `enomem_panic()` calls `pr_emerg()` using `%d` in the format specifier string to print a value of type `size_t`. Change it to `%zu`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* xfuncs: Be more informative when out of memory panic occursSascha Hauer2017-04-281-8/+24
| | | | | | | | When one of the xfuncs panics we can be a bit more informative. We can at least print the amount of bytes we wanted to allocate and how much memory we have left. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* xstrdup: don't panic on xstrdup(NULL)Uwe Kleine-König2016-09-121-1/+6
| | | | | | | | | | | | Instead return just NULL. This matches the behaviour of kstrdup in the kernel and xstrdup in busybox. This fixes a panic with CONFIG_CMD_MAGICVAR=y and CONFIG_CMD_MAGICVAR_HELP unset in magicvar_add() where description is always NULL. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-1/+1
| | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* xfuncs: add wrapper for wchar strdup functionsMichael Olbrich2015-07-231-0/+31
| | | | | Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* xfuncs: add xasprintf() and xvasprintf()Michael Olbrich2015-07-231-0/+24
| | | | | Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* xfuncs: import xstrndup() from busyboxMarc Kleine-Budde2015-06-181-0/+22
| | | | | | | | This function is needed for the fixed length string feature in the state framework. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* xfuncs: remove debugging outputSascha Hauer2015-05-151-4/+0
| | | | | | | Adding debug statements to this code path does not make much sense since when enabled it will massively spam the console. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Add (x)memdupSascha Hauer2013-11-271-0/+10
| | | | | | It's a common task to duplicate some memory. Add (x)memdup functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix format specifiersSascha Hauer2013-01-271-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-3/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix error handling with malloc, memalign etc. Introduce xmemalign().Krzysztof Halasa2011-01-071-0/+8
| | | | | | | | | | | | | | The idea is to panic() when there is no memory available for normal operation. Exception: code which can consume arbitrary amount of RAM (example: files allocated in ramfs) must report error instead of panic(). This patch also fixes code which didn't check for NULL from malloc() etc. Usage: malloc(), memalign() return NULL when out of RAM. xmalloc(), xmemalign() always return non-NULL or panic(). Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add xstrdup functionSascha Hauer2009-09-251-0/+10
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* export functionsSascha Hauer2007-10-041-0/+5
|
* add debug for xmalloc and xreallocSascha Hauer2007-09-241-0/+4
|
* svn_rev_706Sascha Hauer2007-07-051-0/+23
| | | | add file headers
* svn_rev_643Sascha Hauer2007-07-051-0/+30
structure cleanup