diff options
author | Steven Schubiger <stsc@refcnt.org> | 2017-08-02 11:07:02 +0200 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2017-08-02 11:07:02 +0200 |
commit | ef3ba3bb9a06cffad7b4530a88f36b871abe2e0d (patch) | |
tree | 468e6c243ba0f6a1e53dfe8605f997f4ac787301 /colorize.c | |
parent | 13b184a21e6ede64a9cf16f20dd774ea8cd45c4f (diff) | |
download | colorize-ef3ba3bb9a06cffad7b4530a88f36b871abe2e0d.tar.gz colorize-ef3ba3bb9a06cffad7b4530a88f36b871abe2e0d.tar.bz2 |
Optimize extracting invalid attribute name
Diffstat (limited to 'colorize.c')
-rw-r--r-- | colorize.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -469,11 +469,10 @@ process_opt_attr (const char *p) } if (!valid_attr) { - char *sep; - char *attr_invalid = xstrdup (s); + char *attr_invalid = xmalloc ((p - s) + 1); STACK_VAR (attr_invalid); - if ((sep = strchr (attr_invalid, ','))) - *sep = '\0'; + strncpy (attr_invalid, s, p - s); + attr_invalid[p - s] = '\0'; vfprintf_fail ("--attr switch attribute '%s' is not valid", attr_invalid); } } |