diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2014-07-15 23:12:28 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2014-07-16 00:54:23 +0200 |
commit | c4199467296eb21488258f29f7029891d918b585 (patch) | |
tree | 9236f399e97ba418d1b87ff9d646ce0da1c0e20d | |
parent | 2921eed702d994352c5afccc31e32bd3f1682b6b (diff) | |
download | xK-c4199467296eb21488258f29f7029891d918b585.tar.gz xK-c4199467296eb21488258f29f7029891d918b585.tar.xz xK-c4199467296eb21488258f29f7029891d918b585.zip |
Cleanup
No functional changes.
-rw-r--r-- | src/common.c | 31 | ||||
-rw-r--r-- | src/siphash.c | 2 |
2 files changed, 11 insertions, 22 deletions
diff --git a/src/common.c b/src/common.c index 6bef268..e20c79d 100644 --- a/src/common.c +++ b/src/common.c @@ -1551,17 +1551,11 @@ regex_compile (const char *regex, int flags, struct error **e) if (!err) return re; - struct str desc; - str_init (&desc); - - size_t required = regerror (err, re, NULL, 0); - str_ensure_space (&desc, required); - desc.len += regerror (err, re, - desc.str + desc.len, desc.alloc - desc.len) - 1; + char buf[regerror (err, re, NULL, 0)]; + regerror (err, re, buf, sizeof buf); free (re); - error_set (e, "%s: %s", "failed to compile regular expression", desc.str); - str_free (&desc); + error_set (e, "%s: %s", "failed to compile regular expression", buf); return NULL; } @@ -1799,17 +1793,7 @@ read_config_file (struct str_map *config, struct error **e) start++; char *end = strchr (start, '='); - if (!end) - { - if (*start) - { - error_set (e, "line %u in config: %s", - line_no, "malformed input"); - errors = true; - break; - } - } - else + if (end) { char *value = end + 1; do @@ -1818,11 +1802,16 @@ read_config_file (struct str_map *config, struct error **e) str_map_set (config, start, xstrdup (value)); } + else if (*start) + { + error_set (e, "line %u in config: %s", line_no, "malformed input"); + errors = true; + break; + } } str_free (&line); fclose (fp); - return !errors; } diff --git a/src/siphash.c b/src/siphash.c index fa102cc..842af7d 100644 --- a/src/siphash.c +++ b/src/siphash.c @@ -9,7 +9,7 @@ #include "siphash.h" -static uint64_t inline +inline static uint64_t u8to64_le (const unsigned char *p) { return |