Skip to content

Commit

Permalink
clang: suppress a warning
Browse files Browse the repository at this point in the history
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;
      ^
  • Loading branch information
kou committed Jun 11, 2013
1 parent 32cb21b commit f9dfc31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/query_expanders/tsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: ";
Expand Down

0 comments on commit f9dfc31

Please sign in to comment.