Kouhei Sutou
null+****@clear*****
Thu May 12 17:42:10 JST 2016
Kouhei Sutou 2016-05-12 17:42:10 +0900 (Thu, 12 May 2016) New Revision: bc838eb31c6b99854ba53207c927239105a3dad9 https://github.com/groonga/groonga/commit/bc838eb31c6b99854ba53207c927239105a3dad9 Message: select: fix build error Modified files: lib/proc/proc_select.c Modified: lib/proc/proc_select.c (+41 -41) =================================================================== --- lib/proc/proc_select.c 2016-05-12 17:39:33 +0900 (4b900b3) +++ lib/proc/proc_select.c 2016-05-12 17:42:10 +0900 (fbca4c4) @@ -130,6 +130,47 @@ grn_proc_syntax_expand_query(grn_ctx *ctx, query_expander, expanded_query); } +static grn_table_group_flags +grn_parse_table_group_calc_types(grn_ctx *ctx, + const char *calc_types, + unsigned int calc_types_len) +{ + grn_table_group_flags flags = 0; + const char *calc_types_end = calc_types + calc_types_len; + + while (calc_types < calc_types_end) { + if (*calc_types == ',' || *calc_types == ' ') { + calc_types += 1; + continue; + } + +#define CHECK_TABLE_GROUP_CALC_TYPE(name)\ + if (((calc_types_end - calc_types) >= (sizeof(#name) - 1)) &&\ + (!memcmp(calc_types, #name, sizeof(#name) - 1))) {\ + flags |= GRN_TABLE_GROUP_CALC_ ## name;\ + calc_types += sizeof(#name) - 1;\ + continue;\ + } + + CHECK_TABLE_GROUP_CALC_TYPE(COUNT); + CHECK_TABLE_GROUP_CALC_TYPE(MAX); + CHECK_TABLE_GROUP_CALC_TYPE(MIN); + CHECK_TABLE_GROUP_CALC_TYPE(SUM); + CHECK_TABLE_GROUP_CALC_TYPE(AVG); + +#define GRN_TABLE_GROUP_CALC_NONE 0 + CHECK_TABLE_GROUP_CALC_TYPE(NONE); +#undef GRN_TABLE_GROUP_CALC_NONE + + ERR(GRN_INVALID_ARGUMENT, "invalid table group calc type: <%.*s>", + (int)(calc_types_end - calc_types), calc_types); + return 0; +#undef CHECK_TABLE_GROUP_CALC_TYPE + } + + return flags; +} + static const char * grn_column_stage_name(grn_column_stage stage) { @@ -843,47 +884,6 @@ grn_select_apply_columns(grn_ctx *ctx, grn_hash_cursor_close(ctx, columns_cursor); } -static grn_table_group_flags -grn_parse_table_group_calc_types(grn_ctx *ctx, - const char *calc_types, - unsigned int calc_types_len) -{ - grn_table_group_flags flags = 0; - const char *calc_types_end = calc_types + calc_types_len; - - while (calc_types < calc_types_end) { - if (*calc_types == ',' || *calc_types == ' ') { - calc_types += 1; - continue; - } - -#define CHECK_TABLE_GROUP_CALC_TYPE(name)\ - if (((calc_types_end - calc_types) >= (sizeof(#name) - 1)) &&\ - (!memcmp(calc_types, #name, sizeof(#name) - 1))) {\ - flags |= GRN_TABLE_GROUP_CALC_ ## name;\ - calc_types += sizeof(#name) - 1;\ - continue;\ - } - - CHECK_TABLE_GROUP_CALC_TYPE(COUNT); - CHECK_TABLE_GROUP_CALC_TYPE(MAX); - CHECK_TABLE_GROUP_CALC_TYPE(MIN); - CHECK_TABLE_GROUP_CALC_TYPE(SUM); - CHECK_TABLE_GROUP_CALC_TYPE(AVG); - -#define GRN_TABLE_GROUP_CALC_NONE 0 - CHECK_TABLE_GROUP_CALC_TYPE(NONE); -#undef GRN_TABLE_GROUP_CALC_NONE - - ERR(GRN_INVALID_ARGUMENT, "invalid table group calc type: <%.*s>", - (int)(calc_types_end - calc_types), calc_types); - return 0; -#undef CHECK_TABLE_GROUP_CALC_TYPE - } - - return flags; -} - static void grn_select_drilldown(grn_ctx *ctx, grn_obj *table, -------------- next part -------------- HTML����������������������������...下载