[Groonga-commit] groonga/groonga [master] suppress warnings.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 9月 20日 (月) 06:47:57 JST


Kouhei Sutou	2010-09-19 21:47:57 +0000 (Sun, 19 Sep 2010)

  New Revision: b527ca62d084019c7dfbb3209367e314c3934bef

  Log:
    suppress warnings.
    
    Reported by MATSUU Takuto. Thanks!!!

  Modified files:
    modules/suggest/suggest.c

  Modified: modules/suggest/suggest.c (+16 -8)
===================================================================
--- modules/suggest/suggest.c    2010-09-19 21:44:39 +0000 (7a5123b)
+++ modules/suggest/suggest.c    2010-09-19 21:47:57 +0000 (d0f47bd)
@@ -97,12 +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;
+          grn_rset_recinfo *ri = NULL;
+          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), (void **)&ri, NULL)) {
+                           &post_id, sizeof(grn_id), &value, NULL)) {
             ri->score += score;
           }
         }
@@ -192,8 +194,10 @@ complete(grn_ctx *ctx, grn_obj *table, grn_obj *col, grn_obj *query, grn_obj *so
                 while ((p = grn_ii_cursor_next(ctx, icur))) {
                   int32_t score;
                   grn_rset_recinfo *ri;
+                  void *value;
+                  value = ri;
                   grn_hash_add(ctx, (grn_hash *)res,
-                               &p->rid, sizeof(grn_id), (void **)&ri, NULL);
+                               &p->rid, sizeof(grn_id), &value, NULL);
                   GRN_BULK_REWIND(&item_freq);
                   GRN_BULK_REWIND(&item_boost);
                   grn_obj_get_value(ctx, items_freq, p->rid, &item_freq);
@@ -221,7 +225,9 @@ complete(grn_ctx *ctx, grn_obj *table, grn_obj *col, grn_obj *query, grn_obj *so
         while ((id = grn_table_cursor_next(ctx, cur))) {
           int32_t score;
           grn_rset_recinfo *ri;
-          grn_hash_add(ctx, (grn_hash *)res, &id, sizeof(grn_id), (void **)&ri, NULL);
+          void *value;
+          value = ri;
+          grn_hash_add(ctx, (grn_hash *)res, &id, sizeof(grn_id), &value, NULL);
           GRN_BULK_REWIND(&item_freq);
           GRN_BULK_REWIND(&item_boost);
           grn_obj_get_value(ctx, items_freq, id, &item_freq);
@@ -273,11 +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;
-              grn_rset_recinfo *ri;
+              grn_id *rp = NULL;
+              grn_rset_recinfo *ri = NULL;
+              void *key, *value;
+              key = rp;
+              value = ri;
               while (grn_hash_cursor_next(ctx, hc)) {
-                if (grn_hash_cursor_get_key_value(ctx, hc, (void **)(&rp), NULL,
-                                                  (void **)(&ri))) {
+                if (grn_hash_cursor_get_key_value(ctx, hc, &key, NULL, &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