summaryrefslogtreecommitdiff
path: root/lib/string.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2019-02-25 23:28:36 +0100
committerMaria Matejka <mq@ucw.cz>2019-02-25 23:28:36 +0100
commit2915e711f77d68dff756babd19af8da1677c4549 (patch)
tree3fb2f8b5decbc9db40c5b9b00847dc49c0703f21 /lib/string.h
parent99911873a196975f5221aad89ae5eac42e1330e0 (diff)
Custom number parser to speed up config parsing
The glibc's generic parser is slow due to its versatility. Specialized parsers for base-10 and base-16 are much faster and we don't use other bases.
Diffstat (limited to 'lib/string.h')
-rw-r--r--lib/string.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/string.h b/lib/string.h
index 0d34f9c5..5f7c4666 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -24,6 +24,10 @@ int buffer_vprint(buffer *buf, const char *fmt, va_list args);
int buffer_print(buffer *buf, const char *fmt, ...);
void buffer_puts(buffer *buf, const char *str);
+#define bstrtoul(str, end, base) bstrtoul##base(str, end)
+u64 bstrtoul10(const char *str, char **end);
+u64 bstrtoul16(const char *str, char **end);
+
int patmatch(const byte *pat, const byte *str);
static inline char *xbasename(const char *str)