diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-11-07 13:46:12 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-11-07 13:46:12 +0200 |
commit | ac4200fa46eebfc9227130739ae7f867e3fd0a20 (patch) | |
tree | dcfda4ae2e86aba36ea5b34296fb5972dd715ebd /src | |
parent | 29aae24c51c9682a789c09e37e631b886affcbf7 (diff) | |
download | vmod-binlog-ac4200fa46eebfc9227130739ae7f867e3fd0a20.tar.gz vmod-binlog-ac4200fa46eebfc9227130739ae7f867e3fd0a20.tar.bz2 |
Fix interval initialization from the module_init function.
* doc/vmod-binlog.3: Update.
* src/binlogsel.c (interval) <name>: Remove const.
(interval_add): duplicate the name.
* src/xalloc.c (xstrdup): New function.
* src/xalloc.h: Likewise.
Diffstat (limited to 'src')
-rw-r--r-- | src/binlogsel.c | 4 | ||||
-rw-r--r-- | src/xalloc.c | 5 | ||||
-rw-r--r-- | src/xalloc.h | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/binlogsel.c b/src/binlogsel.c index 547b4ec..80f5b83 100644 --- a/src/binlogsel.c +++ b/src/binlogsel.c @@ -70,3 +70,3 @@ struct interval { struct interval *next; - const char *name; + char *name; int timemask; @@ -83,3 +83,3 @@ interval_add(const char *name, int tmask, time_t start, time_t end) p->next = NULL; - p->name = name; + p->name = xstrdup(name); p->timemask = tmask; diff --git a/src/xalloc.c b/src/xalloc.c index d12a04c..6ab6802 100644 --- a/src/xalloc.c +++ b/src/xalloc.c @@ -51,2 +51,7 @@ xmemdup(void const *p, size_t s) +char * +xstrdup(const char *s) +{ + return xmemdup(s, strlen(s) + 1); +} diff --git a/src/xalloc.h b/src/xalloc.h index da7922f..eb49573 100644 --- a/src/xalloc.h +++ b/src/xalloc.h @@ -3 +3,2 @@ void *xmemdup(void const *p, size_t s); void *xcalloc(size_t count, size_t size); +char *xstrdup(const char *s); |