summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common.c31
-rw-r--r--src/siphash.c2
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