* src/lha_macro.h: ditto.
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@49
6a8cc165-1e22-0410-a132-
eb4e3f353aba
extern char *xmalloc();
extern char *xrealloc();
extern char *xmalloc();
extern char *xrealloc();
/* external variables */
extern int errno;
/* external variables */
extern int errno;
ac = argc;
av = (char **)xmalloc( sizeof(char*)*argc );
for (i=0; i<argc; i++) {
ac = argc;
av = (char **)xmalloc( sizeof(char*)*argc );
for (i=0; i<argc; i++) {
- if ((av[i] = strdup( argv[i] )) == NULL)
- fatal_error("not enough memory\n");
+ av[i] = xstrdup( argv[i] );
}
if (strlen(inpbuf) < 1)
continue;
}
if (strlen(inpbuf) < 1)
continue;
- if ((xfilev[cmd_filec++] = (char *) strdup(inpbuf)) == NULL)
- fatal_error("Virtual memory exhausted\n");
+ xfilev[cmd_filec++] = xstrdup(inpbuf);
}
xfilev[cmd_filec] = NULL;
cmd_filev = xfilev;
}
xfilev[cmd_filec] = NULL;
cmd_filev = xfilev;
+char *
+xstrdup(str)
+ char *str;
+{
+ int len = strlen(str);
+ char *p = (char *)xmalloc(str + 1);
+ if (!p)
+ fatal_error("Not enough memory");
+ strcpy(p, str);
+ return p;
+}
+
/* ------------------------------------------------------------------------ */
/* STRING POOL */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* STRING POOL */
/* ------------------------------------------------------------------------ */