diff options
author | Thomas White <taw@bitwiz.org.uk> | 2013-05-23 23:28:49 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2013-05-23 23:28:49 +0200 |
commit | c11f7f9735c0573b3ff5a073e8ae6014933660cd (patch) | |
tree | ba808115b8c68cfdb9a3ba7feea38ba66202c5da /src/loadsave.c | |
parent | 050c29036e59a340f27de7bb80ce7dd2aacb212e (diff) |
Default stylesheet stuff
Diffstat (limited to 'src/loadsave.c')
-rw-r--r-- | src/loadsave.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/loadsave.c b/src/loadsave.c index 8ee089a..7522528 100644 --- a/src/loadsave.c +++ b/src/loadsave.c @@ -358,6 +358,34 @@ int deserialize_file(FILE *fh, struct ds_node *root) } +int deserialize_memory(const char *s, struct ds_node *root) +{ + char *end; + int done; + struct ds_node *cur_node = root; + + done = 0; + do { + + char *line; + + end = strchr(s, '\n'); + if ( end == NULL ) { + parse_line(root, &cur_node, s); + done = 1; + } else { + line = strndup(s, end-s); + parse_line(root, &cur_node, line); + free(line); + s = end+1; + } + + } while ( !done ); + + return 0; +} + + void free_ds_tree(struct ds_node *root) { int i; |