Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* Arkadiusz Mikiewicz (1999-02-22)
* Li Zefan (2007-09-10).
*/
+
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <grp.h>
#include "c.h"
+#include "xalloc.h"
#include "nls.h"
#include "widechar.h"
if (nm->relstart)
sz += nm->relstart + 1;
}
- nm->abslink = malloc(sz + 1);
- if (!nm->abslink)
- err(EXIT_FAILURE, _("out of memory?"));
+ nm->abslink = xmalloc(sz + 1);
if (*sym != '/' && nm->relstart) {
/* create the absolute path from the relative symlink */
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+
#include "nls.h"
+#include "xalloc.h"
static char *progname;
flen = strlen(from);
tlen = strlen(to);
slen = strlen(s);
- newname = malloc(tlen+slen+1);
- if (newname == NULL) {
- fprintf(stderr, _("%s: out of memory\n"), progname);
- exit(1);
- }
+ newname = xmalloc(tlen+slen+1);
p = s;
q = newname;
#endif
#include "c.h"
+#include "xalloc.h"
#include "nls.h"
#if __GNU_LIBRARY__ < 5
#include <blkid.h>
#include "nls.h"
+#include "xalloc.h"
#include "strtosize.h"
struct wipe_desc {
return wp;
}
-static inline void *
-xmalloc(size_t sz)
-{
- void *x = malloc(sz);
- if (!x)
- err(EXIT_FAILURE, _("malloc failed"));
- return x;
-}
-
static inline char *
xstrdup(const char *s)
{