[Groonga-commit] groonga/groonga [master] fix wrong variable usage.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 9月 20日 (月) 07:00:00 JST


Kouhei Sutou	2010-09-19 22:00:00 +0000 (Sun, 19 Sep 2010)

  New Revision: 70a0d5221b2975f1d2aba3f069109b16180d4a4a

  Log:
    fix wrong variable usage.

  Modified files:
    modules/suggest/suggest.c

  Modified: modules/suggest/suggest.c (+8 -8)
===================================================================
--- modules/suggest/suggest.c    2010-09-19 21:47:57 +0000 (d0f47bd)
+++ modules/suggest/suggest.c    2010-09-19 22:00:00 +0000 (9ecd01b)
@@ -97,14 +97,14 @@ cooccur_search(grn_ctx *ctx, grn_obj *table, grn_id id, grn_obj *res, int query_
         pfreq = GRN_INT32_VALUE(&pair_freq);
         ifreq = GRN_INT32_VALUE(&item_freq);
         if (pfreq && ifreq) {
-          grn_rset_recinfo *ri = NULL;
+          grn_rset_recinfo *ri;
           void *value;
           int32_t score = pfreq;
           if (max_score < score) { max_score = score; }
           /* put any formula if desired */
-          value = ri;
           if (grn_hash_add(ctx, (grn_hash *)res,
                            &post_id, sizeof(grn_id), &value, NULL)) {
+            ri = value;
             ri->score += score;
           }
         }
@@ -195,9 +195,9 @@ complete(grn_ctx *ctx, grn_obj *table, grn_obj *col, grn_obj *query, grn_obj *so
                   int32_t score;
                   grn_rset_recinfo *ri;
                   void *value;
-                  value = ri;
                   grn_hash_add(ctx, (grn_hash *)res,
                                &p->rid, sizeof(grn_id), &value, NULL);
+                  ri = value;
                   GRN_BULK_REWIND(&item_freq);
                   GRN_BULK_REWIND(&item_boost);
                   grn_obj_get_value(ctx, items_freq, p->rid, &item_freq);
@@ -226,8 +226,8 @@ complete(grn_ctx *ctx, grn_obj *table, grn_obj *col, grn_obj *query, grn_obj *so
           int32_t score;
           grn_rset_recinfo *ri;
           void *value;
-          value = ri;
           grn_hash_add(ctx, (grn_hash *)res, &id, sizeof(grn_id), &value, NULL);
+          ri = value;
           GRN_BULK_REWIND(&item_freq);
           GRN_BULK_REWIND(&item_boost);
           grn_obj_get_value(ctx, items_freq, id, &item_freq);
@@ -279,13 +279,13 @@ correct(grn_ctx *ctx, grn_obj *table, grn_obj *query, grn_obj *sortby,
                                                        0, NULL, 0, 0, -1, 0);
             if (hc) {
               int32_t score;
-              grn_id *rp = NULL;
-              grn_rset_recinfo *ri = NULL;
+              grn_id *rp;
+              grn_rset_recinfo *ri;
               void *key, *value;
-              key = rp;
-              value = ri;
               while (grn_hash_cursor_next(ctx, hc)) {
                 if (grn_hash_cursor_get_key_value(ctx, hc, &key, NULL, &value)) {
+                  rp = key;
+                  ri = value;
                   GRN_BULK_REWIND(&item_freq2);
                   GRN_BULK_REWIND(&item_boost);
                   grn_obj_get_value(ctx, items_freq2, *rp, &item_freq2);




Groonga-commit メーリングリストの案内
Back to archive index