[Groonga-commit] groonga/groonga at f9dfc31 [master] clang: suppress a warning

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Tue Jun 11 17:56:12 JST 2013


Kouhei Sutou	2013-06-11 17:56:12 +0900 (Tue, 11 Jun 2013)

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

  Message:
    clang: suppress a warning
    
    Set missing default value.
    
        tsv.c:105:16: warning: variable 'encoding' is used uninitialized whenever 'if'
              condition is false [-Wsometimes-uninitialized]
            } else if (strncasecmp(encoding_name, "KOI8-R", strlen("KOI8-R")) == 0 ||
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        tsv.c:114:10: note: uninitialized use occurs here
          return encoding;
                 ^~~~~~~~
        tsv.c:105:12: note: remove the 'if' if its condition is always true
            } else if (strncasecmp(encoding_name, "KOI8-R", strlen("KOI8-R")) == 0 ||
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        tsv.c:79:3: note: variable 'encoding' is declared here
          grn_encoding encoding;
          ^

  Modified files:
    plugins/query_expanders/tsv.c

  Modified: plugins/query_expanders/tsv.c (+1 -1)
===================================================================
--- plugins/query_expanders/tsv.c    2013-06-11 17:53:55 +0900 (25fbf63)
+++ plugins/query_expanders/tsv.c    2013-06-11 17:56:12 +0900 (5d521eb)
@@ -76,7 +76,7 @@ is_comment_mark(char character)
 static inline grn_encoding
 detect_coding_part(grn_ctx *ctx, const char *line, size_t line_length)
 {
-  grn_encoding encoding;
+  grn_encoding encoding = GRN_ENC_NONE;
   grn_obj null_terminated_line_buffer;
   const char *c_line;
   const char *coding_part_keyword = "coding: ";
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る