summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-03 01:27:27 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-03 01:27:27 +0200
commitbd8dcb97354bc29050e5aefe957c651bf2fedd07 (patch)
treea2136790e88df12a0a7607811c02fc05f3413e2c /src/fastd.h
parenta25640e3b49e7abdf8930d9439a85d066b5235f2 (diff)
downloadfastd-bd8dcb97354bc29050e5aefe957c651bf2fedd07.tar
fastd-bd8dcb97354bc29050e5aefe957c651bf2fedd07.zip
Keep list of strings allocated by the lexer
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 5e62fb0..f402be8 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -132,6 +132,11 @@ struct _fastd_context {
unsigned int randseed;
};
+struct _fastd_config_str {
+ fastd_config_str *next;
+ char str[];
+};
+
void fastd_printf(const fastd_context *ctx, const char *format, ...);
void fastd_read_config_dir(fastd_context *ctx, fastd_config *conf, const char *dir, int depth);
@@ -225,6 +230,22 @@ static inline size_t fastd_max_packet_size(const fastd_context *ctx) {
}
}
+static inline fastd_config_str* fastd_config_str_dup(const char *str) {
+ fastd_config_str *ret = malloc(sizeof(fastd_config_str) + strlen(str) + 1);
+ ret->next = NULL;
+ strcpy(ret->str, str);
+
+ return ret;
+}
+
+static inline void fastd_config_str_free(fastd_config_str *str) {
+ while(str) {
+ fastd_config_str *next = str->next;
+ free(str);
+ str = next;
+ }
+}
+
static inline bool timespec_after(const struct timespec *tp1, const struct timespec *tp2) {
return (tp1->tv_sec > tp2->tv_sec ||
(tp1->tv_sec == tp2->tv_sec && tp1->tv_nsec > tp2->tv_nsec));