Navigation Menu

Skip to content

Commit

Permalink
clang: suppress a warning
Browse files Browse the repository at this point in the history
Initialize variable explicitly.

    ii.c:2909:17: warning: variable 'dcn' is used uninitialized whenever '||'
          condition is true [-Wsometimes-uninitialized]
                if (!actual_chunk_size || !(rc = chunk_new(ctx, ii, &dcn,...
                    ^~~~~~~~~~~~~~~~~~
    ii.c:2911:50: note: uninitialized use occurs here
                  fake_map2(ctx, ii->chunk, &dw, dc, dcn, actual_chunk_size);
                                                     ^~~
    ii.c:2909:17: note: remove the '||' if its condition is always false
                if (!actual_chunk_size || !(rc = chunk_new(ctx, ii, &dcn,...
                    ^~~~~~~~~~~~~~~~~~~~~
    ii.c:2886:30: note: initialize the variable 'dcn' to silence this warning
      uint32_t ds, pseg, scn, dcn;
                                 ^
                                  = 0
  • Loading branch information
kou committed Jun 11, 2013
1 parent d1845f7 commit 3f8b8f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ii.c
Expand Up @@ -2883,7 +2883,7 @@ buffer_flush(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h)
grn_io_win sw, dw;
buffer *sb, *db = NULL;
uint8_t *dc, *sc = NULL;
uint32_t ds, pseg, scn, dcn;
uint32_t ds, pseg, scn, dcn = 0;
if (ii->header->binfo[seg] == NOT_ASSIGNED) { return GRN_FILE_CORRUPT; }
if ((ds = segment_get(ctx, ii)) == MAX_PSEG) { return GRN_NO_MEMORY_AVAILABLE; }
pseg = buffer_open(ctx, ii, SEG2POS(seg, 0), NULL, &sb);
Expand Down

0 comments on commit 3f8b8f5

Please sign in to comment.