null+****@clear*****
null+****@clear*****
2010年 6月 15日 (火) 19:07:30 JST
Daijiro MORI 2010-06-15 10:07:30 +0000 (Tue, 15 Jun 2010) New Revision: 0a261c833dcd408713c95249e7b7f46bf542d344 Log: grn_expr_add_var() interprets the name of variable as '$nvars' when name is void Modified files: lib/expr.c Modified: lib/expr.c (+8 -1) =================================================================== --- lib/expr.c 2010-06-15 07:25:35 +0000 (8188894) +++ lib/expr.c 2010-06-15 10:07:30 +0000 (544c979) @@ -646,7 +646,14 @@ grn_expr_add_var(grn_ctx *ctx, grn_obj *expr, const char *name, unsigned name_si } if (e->vars && e->nvars < GRN_STACK_SIZE) { v = e->vars + e->nvars++; - GRN_TEXT_PUT(ctx, &e->name_buf, name, name_size); + if (name_size) { + GRN_TEXT_PUT(ctx, &e->name_buf, name, name_size); + } else { + uint32_t ol = GRN_TEXT_LEN(&e->name_buf); + GRN_TEXT_PUTC(ctx, &e->name_buf, '$'); + grn_text_itoa(ctx, &e->name_buf, e->nvars); + name_size = GRN_TEXT_LEN(&e->name_buf) - ol; + } v->name_size = name_size; res = &v->value; GRN_VOID_INIT(res);