[Groonga-commit] groonga/groonga at cc253d6 [master] Reduce scope

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jan 16 15:43:19 JST 2017


Kouhei Sutou	2017-01-16 15:43:19 +0900 (Mon, 16 Jan 2017)

  New Revision: cc253d630d00dfa647b3c0be68b875a263203c40
  https://github.com/groonga/groonga/commit/cc253d630d00dfa647b3c0be68b875a263203c40

  Message:
    Reduce scope

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+3 -3)
===================================================================
--- lib/ii.c    2017-01-16 15:37:32 +0900 (8754dd8)
+++ lib/ii.c    2017-01-16 15:43:19 +0900 (e7e2fae)
@@ -3972,9 +3972,6 @@ buffer_new(grn_ctx *ctx, grn_ii *ii, int size, uint32_t *pos,
   buffer *b = NULL;
   grn_id tid;
   uint16_t offset;
-  char key[GRN_TABLE_MAX_KEY_SIZE];
-  int key_size = grn_table_get_key(ctx, ii->lexicon, id, key,
-                                   GRN_TABLE_MAX_KEY_SIZE);
   uint32_t *a, lseg = NOT_ASSIGNED, pseg = NOT_ASSIGNED;
   grn_table_cursor *tc = NULL;
   if (S_SEGMENT - sizeof(buffer_header) < size + sizeof(buffer_term)) {
@@ -3988,6 +3985,9 @@ buffer_new(grn_ctx *ctx, grn_ii *ii, int size, uint32_t *pos,
     return NOT_ASSIGNED;
   }
   if (ii->lexicon->header.type == GRN_TABLE_PAT_KEY) {
+    char key[GRN_TABLE_MAX_KEY_SIZE];
+    int key_size = grn_table_get_key(ctx, ii->lexicon, id, key,
+                                     GRN_TABLE_MAX_KEY_SIZE);
     if (ii->lexicon->header.flags & GRN_OBJ_KEY_VAR_SIZE) {
       tc = grn_table_cursor_open(ctx, ii->lexicon, key, key_size, NULL, 0, 0, -1,
                                  GRN_CURSOR_ASCENDING|GRN_CURSOR_GT);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index