summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-07 20:12:05 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-07 20:12:05 (GMT)
commit6079aba813fbeaffb174791cda51ea588e5cca20 (patch) (side-by-side diff)
treed686b683053d57e4925d6ba17f0ae26fb6343c43 /src
parent4b0e477181f51c12f62236ec91f4bb714125393d (diff)
downloadgrecs-6079aba813fbeaffb174791cda51ea588e5cca20.tar.gz
grecs-6079aba813fbeaffb174791cda51ea588e5cca20.tar.bz2
Bugfixes.
* src/grecs.h (GRECS_MULT): New flag. * src/lookup.c (parse_label): Allocate array elements. * src/tree.c (grecs_process_ident): Store string duplicates in lists. (reduceproc): Ignore keywords marked with GRECS_MULT.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/grecs.h1
-rw-r--r--src/lookup.c2
-rw-r--r--src/tree.c6
3 files changed, 7 insertions, 2 deletions
diff --git a/src/grecs.h b/src/grecs.h
index 628f9f2..25f068f 100644
--- a/src/grecs.h
+++ b/src/grecs.h
@@ -74,6 +74,7 @@ enum grecs_data_type {
};
#define GRECS_AGGR 0x1000
+#define GRECS_MULT 0x2000
#define GRECS_LIST 0x8000
#define GRECS_TYPE_MASK 0x00ff
#define GRECS_TYPE(c) ((c) & GRECS_TYPE_MASK)
diff --git a/src/lookup.c b/src/lookup.c
index 32674ad..b723283 100644
--- a/src/lookup.c
+++ b/src/lookup.c
@@ -164,6 +164,8 @@ parse_label(const char *str)
val->v.arg.v = grecs_calloc(ws.ws_wordc,
sizeof(val->v.arg.v[0]));
for (i = 0; i < ws.ws_wordc; i++) {
+ val->v.arg.v[i] =
+ grecs_malloc(sizeof(val->v.arg.v[0]));
val->v.arg.v[i]->type = GRECS_TYPE_STRING;
val->v.arg.v[i]->v.string = ws.ws_wordv[i];
}
diff --git a/src/tree.c b/src/tree.c
index 06f15f0..7ec99d6 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -740,7 +740,8 @@ grecs_process_ident(struct grecs_keyword *kwp, grecs_value_t *value,
list = _grecs_simple_list_create(1);
list->cmp = grecs_prop_tab[type].cmp;
if (type == grecs_type_string)
- grecs_list_append(list, value->v.string);
+ grecs_list_append(list,
+ grecs_strdup(value->v.string));
else {
ptr = grecs_malloc(size);
if (grecs_string_convert(ptr, type,
@@ -1050,7 +1051,8 @@ reduceproc(enum grecs_tree_recurse_op op, struct grecs_node *node, void *data)
clos->cursect = kwp;
}
}
- node_reduce(node, kwp, clos->flags);
+ if (!(kwp->type & GRECS_MULT))
+ node_reduce(node, kwp, clos->flags);
}
return grecs_tree_recurse_ok;
}

Return to:

Send suggestions and report system problems to the System administrator.