Navigation Menu

Skip to content

Commit

Permalink
temporary fix for grn_expr_snip() with n_tags == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryo Onodera committed Oct 14, 2009
1 parent c050829 commit 2f4183c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/db.c
Expand Up @@ -10822,12 +10822,22 @@ grn_expr_snip(grn_ctx *ctx, grn_obj *expr, int flags,
}
GRN_FREE(si);
}
for (i = 0;; i = (i + 1) % n_tags) {
grn_obj *q;
GRN_PTR_POP(&snip_stack, q);
if (!q) { break; }
grn_snip_add_cond(ctx, res, GRN_TEXT_VALUE(q), GRN_TEXT_LEN(q),
opentags[i], opentag_lens[i], closetags[i], closetag_lens[i]);
if (n_tags) {
for (i = 0;; i = (i + 1) % n_tags) {
grn_obj *q;
GRN_PTR_POP(&snip_stack, q);
if (!q) { break; }
grn_snip_add_cond(ctx, res, GRN_TEXT_VALUE(q), GRN_TEXT_LEN(q),
opentags[i], opentag_lens[i], closetags[i], closetag_lens[i]);
}
} else {
for (;;) {
grn_obj *q;
GRN_PTR_POP(&snip_stack, q);
if (!q) { break; }
grn_snip_add_cond(ctx, res, GRN_TEXT_VALUE(q), GRN_TEXT_LEN(q),
NULL, 0, NULL, 0);
}
}
GRN_FREE(sis);
GRN_OBJ_FIN(ctx, &but_stack);
Expand Down

0 comments on commit 2f4183c

Please sign in to comment.