From: Karel Zak Date: Thu, 25 Oct 2007 08:19:12 +0000 (+0200) Subject: losetup: remove duplicate xstrdup() and error() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b994f0e9355e43228301ec3cdaaee93149baa77;p=util-linux losetup: remove duplicate xstrdup() and error() Signed-off-by: Karel Zak --- diff --git a/mount/Makefile.am b/mount/Makefile.am index f40bdd7f..57a5af8d 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -25,7 +25,8 @@ umount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) swapon_SOURCES = swapon.c swap_constants.h $(utils_common) -losetup_SOURCES = lomount.c loop.h lomount.h +losetup_SOURCES = lomount.c sundries.c xmalloc.c loop.h lomount.h xmalloc.h \ + sundries.h losetup_CPPFLAGS = -DMAIN $(AM_CPPFLAGS) mount_LDADD = $(LDADD_common) diff --git a/mount/lomount.c b/mount/lomount.c index 737194e9..1373067c 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -22,11 +22,10 @@ #include "lomount.h" #include "xstrncpy.h" #include "nls.h" +#include "sundries.h" +#include "xmalloc.h" -extern int verbose; extern char *progname; -extern char *xstrdup (const char *s); /* not: #include "sundries.h" */ -extern void error (const char *fmt, ...); /* idem */ #define SIZE(a) (sizeof(a)/sizeof(a[0])) @@ -466,34 +465,6 @@ usage(void) { exit(1); } -char * -xstrdup (const char *s) { - char *t; - - if (s == NULL) - return NULL; - - t = strdup (s); - - if (t == NULL) { - fprintf(stderr, _("not enough memory")); - exit(1); - } - - return t; -} - -void -error (const char *fmt, ...) { - va_list args; - - va_start (args, fmt); - vfprintf (stderr, fmt, args); - va_end (args); - fprintf (stderr, "\n"); -} - - int main(int argc, char **argv) { char *p, *offset, *encryption, *passfd, *device, *file;