diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-21 15:22:47 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-21 15:23:26 +0100 |
commit | cdc5e2cec5de1eb29ea3a42148c0b1302e97877f (patch) | |
tree | 0dd8d9fbfd7fb168be5778db93ffc4b6a29f1cc5 /vcal.c | |
parent | Made to compile as C++. (diff) | |
download | calp-cdc5e2cec5de1eb29ea3a42148c0b1302e97877f.tar.gz calp-cdc5e2cec5de1eb29ea3a42148c0b1302e97877f.tar.xz |
Fix c++ compile warnings.
Diffstat (limited to '')
-rw-r--r-- | vcal.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -41,11 +41,11 @@ INIT_F(vcomponent) { return 0; } -INIT_F(vcomponent, char* type) { +INIT_F(vcomponent, const char* type) { return INIT(vcomponent, self, type, NULL); } -INIT_F(vcomponent, char* type, char* filename) { +INIT_F(vcomponent, const char* type, const char* filename) { INIT(TRIE(content_line), &self->clines); INIT(VECT(vcomponent), &self->components); @@ -83,8 +83,15 @@ content_line* RESOLVE(content_line) return dest; } -content_line* get_property (vcomponent* ev, char* key) { - return GET(TRIE(content_line))(&ev->clines, key); +content_line* get_property (vcomponent* ev, const char* key) { + size_t len = strlen(key) + 1; + char* cpy = (char*) (calloc(sizeof(*cpy), len)); + strncpy (cpy, key, len); + + content_line* ret = GET(TRIE(content_line))(&ev->clines, cpy); + + free (cpy); + return ret; } FREE_F(vcomponent) { |