diff options
Diffstat (limited to 'xrefresh.c')
-rw-r--r-- | xrefresh.c | 25 |
1 files changed, 8 insertions, 17 deletions
@@ -1,3 +1,4 @@ +/* $XdotOrg: $ */ /*********************************************************** Copyright 1987, 1988, 1998 The Open Group @@ -82,22 +83,6 @@ Syntax(void) exit (1); } -static char * -copystring(char *s) -{ - int len = (s ? strlen (s) : 0) + 1; - char *retval; - - retval = malloc (len); - if (!retval) { - fprintf (stderr, "%s: unable to allocate %d bytes for string.\n", - ProgramName, len); - exit (1); - } - (void) strcpy (retval, s); - return (retval); -} - /* * The following parses options that should be yes or no; it returns -1, 0, 1 * for error, no, yes. @@ -235,7 +220,13 @@ main(int argc, char *argv[]) char *def; if ((def = XGetDefault (dpy, ProgramName, "Solid")) != NULL) { - solidcolor = copystring (def); + solidcolor = strdup (def); + if (solidcolor == NULL) { + fprintf (stderr, + "%s: unable to allocate memory for string.\n", + ProgramName); + exit (1); + } action = doSolid; } else { struct s_pair *pp; |