Kouhei Sutou
null+****@clear*****
Tue Nov 13 18:17:49 JST 2012
Kouhei Sutou 2012-11-13 18:17:49 +0900 (Tue, 13 Nov 2012) New Revision: 253a95181c34f28019553d9ef6db9c2c29a27d2e https://github.com/groonga/groonga/commit/253a95181c34f28019553d9ef6db9c2c29a27d2e Log: Use GRN_FALSE instead of 0 Modified files: lib/db.c lib/expr.c lib/geo.c Modified: lib/db.c (+3 -3) =================================================================== --- lib/db.c 2012-11-13 18:16:19 +0900 (1730c47) +++ lib/db.c 2012-11-13 18:17:49 +0900 (fba5814) @@ -2968,7 +2968,7 @@ grn_obj_search_column_index(grn_ctx *ctx, grn_obj *obj, grn_obj *query, } if (need_cast) { GRN_OBJ_INIT(&casted_query, GRN_BULK, 0, key_type); - rc = grn_obj_cast(ctx, query, &casted_query, 0); + rc = grn_obj_cast(ctx, query, &casted_query, GRN_FALSE); if (rc == GRN_SUCCESS) { key = GRN_BULK_HEAD(&casted_query); key_len = GRN_BULK_VSIZE(&casted_query); @@ -5213,7 +5213,7 @@ grn_accessor_set_value(grn_ctx *ctx, grn_accessor *a, grn_id id, } else { grn_obj buf; GRN_INT32_INIT(&buf, 0); - grn_obj_cast(ctx, value, &buf, 0); + grn_obj_cast(ctx, value, &buf, GRN_FALSE); memcpy(vp, GRN_BULK_HEAD(&buf), sizeof(int)); GRN_OBJ_FIN(ctx, &buf); } @@ -8770,7 +8770,7 @@ grn_table_sort_key_from_str_geo(grn_ctx *ctx, const char *str, unsigned int str_ GRN_TEXT_INIT(&buf, GRN_OBJ_DO_SHALLOW_COPY); GRN_TEXT_SET(ctx, &buf, p + 1, r - p - 2); /* should be quoted */ k->key = grn_obj_open(ctx, GRN_BULK, 0, domain); - grn_obj_cast(ctx, &buf, k->key, 0); + grn_obj_cast(ctx, &buf, k->key, GRN_FALSE); GRN_OBJ_FIN(ctx, &buf); } k->flags |= GRN_TABLE_SORT_GEO; Modified: lib/expr.c (+9 -9) =================================================================== --- lib/expr.c 2012-11-13 18:16:19 +0900 (f372073) +++ lib/expr.c 2012-11-13 18:17:49 +0900 (0df6169) @@ -965,7 +965,7 @@ grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op, grn_obj dest; if (xd != yd) { GRN_OBJ_INIT(&dest, GRN_BULK, 0, yd); - if (!grn_obj_cast(ctx, x, &dest, 0)) { + if (!grn_obj_cast(ctx, x, &dest, GRN_FALSE)) { grn_obj_reinit(ctx, x, yd, 0); grn_bulk_write(ctx, x, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest)); } @@ -977,7 +977,7 @@ grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj, grn_operator op, grn_obj dest; if (xd != yd) { GRN_OBJ_INIT(&dest, GRN_BULK, 0, xd); - if (!grn_obj_cast(ctx, y, &dest, 0)) { + if (!grn_obj_cast(ctx, y, &dest, GRN_FALSE)) { grn_obj_reinit(ctx, y, xd, 0); grn_bulk_write(ctx, y, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest)); } @@ -1363,7 +1363,7 @@ grn_expr_compile(grn_ctx *ctx, grn_obj *expr) {\ grn_obj y_;\ GRN_OBJ_INIT(&y_, GRN_BULK, 0, x->header.domain);\ - if (grn_obj_cast(ctx, y, &y_, 0)) {\ + if (grn_obj_cast(ctx, y, &y_, GRN_FALSE)) {\ r = 0;\ } else {\ DO_COMPARE_SUB_NUMERIC(&y_, op);\ @@ -1719,13 +1719,13 @@ grn_expr_compile(grn_ctx *ctx, grn_obj *expr) grn_obj dest;\ if (x->header.domain < y->header.domain) {\ GRN_OBJ_INIT(&dest, GRN_BULK, 0, y->header.domain);\ - if (!grn_obj_cast(ctx, x, &dest, 0)) {\ + if (!grn_obj_cast(ctx, x, &dest, GRN_FALSE)) {\ r = (GRN_BULK_VSIZE(&dest) == GRN_BULK_VSIZE(y) &&\ !memcmp(GRN_BULK_HEAD(&dest), GRN_BULK_HEAD(y), GRN_BULK_VSIZE(y))); \ }\ } else {\ GRN_OBJ_INIT(&dest, GRN_BULK, 0, x->header.domain);\ - if (!grn_obj_cast(ctx, y, &dest, 0)) {\ + if (!grn_obj_cast(ctx, y, &dest, GRN_FALSE)) {\ r = (GRN_BULK_VSIZE(&dest) == GRN_BULK_VSIZE(x) &&\ !memcmp(GRN_BULK_HEAD(&dest), GRN_BULK_HEAD(x), GRN_BULK_VSIZE(x))); \ }\ @@ -3633,7 +3633,7 @@ get_weight(grn_ctx *ctx, grn_expr_code *ec) int32_t weight = 1; grn_obj weight_buffer; GRN_INT32_INIT(&weight_buffer, 0); - if (!grn_obj_cast(ctx, ec[1].value, &weight_buffer, 0)) { + if (!grn_obj_cast(ctx, ec[1].value, &weight_buffer, GRN_FALSE)) { weight = GRN_INT32_VALUE(&weight_buffer); } grn_obj_unlink(ctx, &weight_buffer); @@ -4048,7 +4048,7 @@ grn_table_select_select_by_index(grn_ctx *ctx, grn_obj *table, scan_info *si, switch (a->action) { case GRN_ACCESSOR_GET_ID : GRN_UINT32_INIT(&dest, 0); - if (!grn_obj_cast(ctx, si->query, &dest, 0)) { + if (!grn_obj_cast(ctx, si->query, &dest, GRN_FALSE)) { memcpy(&pi, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest)); if (pi.rid) { if (pi.rid == grn_table_at(ctx, table, pi.rid)) { @@ -4062,7 +4062,7 @@ grn_table_select_select_by_index(grn_ctx *ctx, grn_obj *table, scan_info *si, break; case GRN_ACCESSOR_GET_KEY : GRN_OBJ_INIT(&dest, GRN_BULK, 0, table->header.domain); - if (!grn_obj_cast(ctx, si->query, &dest, 0)) { + if (!grn_obj_cast(ctx, si->query, &dest, GRN_FALSE)) { if ((pi.rid = grn_table_get(ctx, table, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest)))) { @@ -4121,7 +4121,7 @@ grn_table_select_select_by_index(grn_ctx *ctx, grn_obj *table, scan_info *si, break; case GRN_ACCESSOR_GET_KEY : GRN_OBJ_INIT(&dest, GRN_BULK, 0, table->header.domain); - if (!grn_obj_cast(ctx, si->query, &dest, 0)) { + if (!grn_obj_cast(ctx, si->query, &dest, GRN_FALSE)) { grn_hash *pres; if ((pres = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, GRN_OBJ_TABLE_HASH_KEY))) { Modified: lib/geo.c (+12 -12) =================================================================== --- lib/geo.c 2012-11-13 18:16:19 +0900 (61516e5) +++ lib/geo.c 2012-11-13 18:17:49 +0900 (ba18e75) @@ -766,7 +766,7 @@ grn_geo_select_in_circle(grn_ctx *ctx, grn_obj *index, if (center_point->header.domain != domain) { GRN_OBJ_INIT(¢er_point_, GRN_BULK, 0, domain); - if (grn_obj_cast(ctx, center_point, ¢er_point_, 0)) { goto exit; } + if (grn_obj_cast(ctx, center_point, ¢er_point_, GRN_FALSE)) { goto exit; } center_point = ¢er_point_; } center = GRN_GEO_POINT_VALUE_RAW(center_point); @@ -812,7 +812,7 @@ grn_geo_select_in_circle(grn_ctx *ctx, grn_obj *index, case GRN_DB_TEXT : case GRN_DB_LONG_TEXT : GRN_OBJ_INIT(&point_on_circle_, GRN_BULK, 0, domain); - if (grn_obj_cast(ctx, point_on_circle, &point_on_circle_, 0)) { goto exit; } + if (grn_obj_cast(ctx, point_on_circle, &point_on_circle_, GRN_FALSE)) { goto exit; } point_on_circle = &point_on_circle_; /* fallthru */ case GRN_DB_TOKYO_GEO_POINT : @@ -1730,7 +1730,7 @@ grn_geo_in_circle(grn_ctx *ctx, grn_obj *point, grn_obj *center, double d; if (center->header.domain != domain) { GRN_OBJ_INIT(¢er_, GRN_BULK, 0, domain); - if (grn_obj_cast(ctx, center, ¢er_, 0)) { goto exit; } + if (grn_obj_cast(ctx, center, ¢er_, GRN_FALSE)) { goto exit; } center = ¢er_; } @@ -1765,7 +1765,7 @@ grn_geo_in_circle(grn_ctx *ctx, grn_obj *point, grn_obj *center, case GRN_DB_TEXT : case GRN_DB_LONG_TEXT : GRN_OBJ_INIT(&radius_or_point_, GRN_BULK, 0, domain); - if (grn_obj_cast(ctx, radius_or_point, &radius_or_point_, 0)) { goto exit; } + if (grn_obj_cast(ctx, radius_or_point, &radius_or_point_, GRN_FALSE)) { goto exit; } radius_or_point = &radius_or_point_; /* fallthru */ case GRN_DB_TOKYO_GEO_POINT : @@ -1805,12 +1805,12 @@ grn_geo_in_rectangle(grn_ctx *ctx, grn_obj *point, if (domain == GRN_DB_TOKYO_GEO_POINT || domain == GRN_DB_WGS84_GEO_POINT) { if (top_left->header.domain != domain) { GRN_OBJ_INIT(&top_left_, GRN_BULK, 0, domain); - if (grn_obj_cast(ctx, top_left, &top_left_, 0)) { goto exit; } + if (grn_obj_cast(ctx, top_left, &top_left_, GRN_FALSE)) { goto exit; } top_left = &top_left_; } if (bottom_right->header.domain != domain) { GRN_OBJ_INIT(&bottom_right_, GRN_BULK, 0, domain); - if (grn_obj_cast(ctx, bottom_right, &bottom_right_, 0)) { goto exit; } + if (grn_obj_cast(ctx, bottom_right, &bottom_right_, GRN_FALSE)) { goto exit; } bottom_right = &bottom_right_; } r = grn_geo_in_rectangle_raw(ctx, @@ -2221,25 +2221,25 @@ grn_geo_distance_rectangle(grn_ctx *ctx, grn_obj *point1, grn_obj *point2) if (domain1 != domain2) { GRN_OBJ_INIT(&point2_, GRN_BULK, 0, domain1); point2_initialized = GRN_TRUE; - if (grn_obj_cast(ctx, point2, &point2_, 0)) { goto exit; } + if (grn_obj_cast(ctx, point2, &point2_, GRN_FALSE)) { goto exit; } point2 = &point2_; } } else if (domain2 == GRN_DB_TOKYO_GEO_POINT || domain2 == GRN_DB_WGS84_GEO_POINT) { GRN_OBJ_INIT(&point1_, GRN_BULK, 0, domain2); point1_initialized = GRN_TRUE; - if (grn_obj_cast(ctx, point1, &point1_, 0)) { goto exit; } + if (grn_obj_cast(ctx, point1, &point1_, GRN_FALSE)) { goto exit; } point1 = &point1_; } else if ((GRN_DB_SHORT_TEXT <= domain1 && domain1 <= GRN_DB_LONG_TEXT) && (GRN_DB_SHORT_TEXT <= domain2 && domain2 <= GRN_DB_LONG_TEXT)) { GRN_OBJ_INIT(&point1_, GRN_BULK, 0, GRN_DB_WGS84_GEO_POINT); point1_initialized = GRN_TRUE; - if (grn_obj_cast(ctx, point1, &point1_, 0)) { goto exit; } + if (grn_obj_cast(ctx, point1, &point1_, GRN_FALSE)) { goto exit; } point1 = &point1_; GRN_OBJ_INIT(&point2_, GRN_BULK, 0, GRN_DB_WGS84_GEO_POINT); point2_initialized = GRN_TRUE; - if (grn_obj_cast(ctx, point2, &point2_, 0)) { goto exit; } + if (grn_obj_cast(ctx, point2, &point2_, GRN_FALSE)) { goto exit; } point2 = &point2_; } else { goto exit; @@ -2268,7 +2268,7 @@ grn_geo_distance_sphere(grn_ctx *ctx, grn_obj *point1, grn_obj *point2) if (point2->header.domain != domain) { GRN_OBJ_INIT(&point2_, GRN_BULK, 0, domain); point2_initialized = GRN_TRUE; - if (grn_obj_cast(ctx, point2, &point2_, 0)) { goto exit; } + if (grn_obj_cast(ctx, point2, &point2_, GRN_FALSE)) { goto exit; } point2 = &point2_; } d = grn_geo_distance_sphere_raw(ctx, @@ -2295,7 +2295,7 @@ grn_geo_distance_ellipsoid(grn_ctx *ctx, grn_obj *point1, grn_obj *point2) if (point2->header.domain != domain) { GRN_OBJ_INIT(&point2_, GRN_BULK, 0, domain); point2_initialized = GRN_TRUE; - if (grn_obj_cast(ctx, point2, &point2_, 0)) { goto exit; } + if (grn_obj_cast(ctx, point2, &point2_, GRN_FALSE)) { goto exit; } point2 = &point2_; } if (domain == GRN_DB_TOKYO_GEO_POINT) { -------------- next part -------------- HTML����������������������������... 다운로드