This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 982f9d91035c3562536ea524b9d16aac1719ce13 (commit) from 10ef775932c40eaa18aa171b43d2c77450d93e43 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/982f9d91035c3562536ea524b9d16aac1719c...
commit 982f9d91035c3562536ea524b9d16aac1719ce13 Author: Cyril Hrubis metan@ucw.cz Date: Tue Dec 17 23:25:47 2013 +0100
spiv: cfg: Two fixes.
* Fix opt_by_key() SegFault on config entry without key or name space
* Fix read_key() to stop on '=' (so that parsing key=value (without spaces around the '=') works too)
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/cfg.c b/demos/spiv/cfg.c index 629929d..b110e07 100644 --- a/demos/spiv/cfg.c +++ b/demos/spiv/cfg.c @@ -39,22 +39,27 @@ struct cfg_opt *opt_by_key(struct cfg_opt *cfg_opts, const char *name_space, { struct cfg_opt *i;
- GP_DEBUG(1, "Looking for key '%s' in name space '%s'", - key, name_space); + GP_DEBUG(1, "Looking for key '%s' in [%s]", key, name_space);
for (i = cfg_opts; !terminal(i); i++) { - if (name_space == NULL) { - if (i->name_space == NULL && !strcmp(key, i->key)) - break; - } else { - if (i->name_space != NULL && !strcmp(key, i->key)) - break; - } + if (!i->key) + continue; + + if (name_space && !i->name_space) + continue; + + if (name_space && strcmp(i->name_space, name_space)) + continue; + + if (!strcmp(key, i->key)) + break; }
if (terminal(i)) return NULL;
+ GP_DEBUG(1, "Found key '%s' in [%s]", i->key, i->name_space); + return i; }
@@ -215,6 +220,7 @@ static int parse_namespace(struct parser_state *state) return 1; case ']': state->name_space[len] = '0'; + GP_DEBUG(1, "In namespace [%s]", state->name_space); return 0; default: state->name_space[len++] = c; @@ -226,9 +232,6 @@ static int parse_namespace(struct parser_state *state) break; } } - - - GP_DEBUG(1, "In namespace '%s'", state->name_space); }
static int read_key(struct parser_state *state) @@ -245,6 +248,8 @@ static int read_key(struct parser_state *state) case EOF: case ' ': case 't': + case '=': + ungetc(c, state->f); state->buf[len] = '0'; GP_DEBUG(1, "Have key '%s'", state->buf); return 0; @@ -352,7 +357,7 @@ static int parse_cfg(struct parser_state *state)
switch (c) { case EOF: - GP_DEBUG(1, "End of config reached at %u", + GP_DEBUG(1, "End of config reached at line %u", state->lineno); return 0; case 'n':
-----------------------------------------------------------------------
Summary of changes: demos/spiv/cfg.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.