[Groonga-commit] groonga/groonga [master] Improved error handling on suggest.c.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 8月 25日 (水) 15:53:56 JST


Tasuku SUENAGA a.k.a. gunyarakun	2010-08-25 06:53:56 +0000 (Wed, 25 Aug 2010)

  New Revision: 1bda573db0bd39e7a35325f740038bc26bff80c9

  Log:
    Improved error handling on suggest.c.

  Modified files:
    modules/suggest/suggest.c

  Modified: modules/suggest/suggest.c (+5 -1)
===================================================================
--- modules/suggest/suggest.c    2010-08-25 04:36:23 +0000 (d68094b)
+++ modules/suggest/suggest.c    2010-08-25 06:53:56 +0000 (e83b254)
@@ -62,15 +62,17 @@ command_suggest(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_dat
                   grn_ii_cursor_close(ctx, icur);
                 } else {
                   ERR(GRN_UNKNOWN_ERROR, "cannot open cursor for index.");
-                  break;
+                  goto exit;
                 }
               }
               grn_table_cursor_close(ctx, cur);
             } else {
               ERR(GRN_UNKNOWN_ERROR, "cannot open cursor for pk.");
+              goto exit;
             }
           } else {
             ERR(GRN_UNKNOWN_ERROR, "cannot find index for prefix search.");
+            goto exit;
           }
 #else
           grn_select_optarg optarg;
@@ -112,6 +114,7 @@ command_suggest(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_dat
               grn_expr_close(ctx, expr);
             } else {
               ERR(GRN_UNKNOWN_ERROR, "error on building expr. for calicurating edit distance");
+              goto exit;
             }
           }
 #endif
@@ -156,6 +159,7 @@ command_suggest(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_dat
               ERR(GRN_UNKNOWN_ERROR, "cannot sort.");
             }
           }
+exit:
           grn_obj_close(ctx, sorted);
         } else {
           ERR(GRN_UNKNOWN_ERROR, "cannot create temporary sort table.");




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