From: Christian Heller Date: Wed, 14 May 2014 02:38:10 +0000 (+0200) Subject: Fix non-initializations that are detected as errors on gcc -O3. X-Git-Tag: tce~747 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/day_todos?a=commitdiff_plain;h=91b0bb33921c0990fbd07e15049e48643f26d7b2;p=plomrogue Fix non-initializations that are detected as errors on gcc -O3. --- diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c index dc655e7..5c35dd6 100644 --- a/src/client/draw_wins.c +++ b/src/client/draw_wins.c @@ -186,7 +186,8 @@ static void add_line_compact(struct Win * win, char * line, attr_t attri, uint32_t len_line_new = len_line + strlen(separator); char line_new[len_line_new]; sprintf(line_new, "%s%s", line, separator); - uint16_t x, y; + uint16_t x = 0; + uint16_t y; uint32_t z; for (z = 0, y = y_start; z < len_line_new; y++) { @@ -204,7 +205,7 @@ static void add_line_compact(struct Win * win, char * line, attr_t attri, try_resize_winmap(win, y + 1 + 1, win->winmap_size.x); } } - * offset = x; + *offset = x; } diff --git a/src/client/interface_conf.c b/src/client/interface_conf.c index f5a0597..6d4d65a 100644 --- a/src/client/interface_conf.c +++ b/src/client/interface_conf.c @@ -143,7 +143,7 @@ static void write_def(FILE * file, char * prefix, uint8_t quotes, char * val, char type) { char * f_name = "write_def()"; - char * val_str; + char * val_str = NULL; int test_val_str = 1; if ('s' == type) { diff --git a/src/common/parse_file.c b/src/common/parse_file.c index ab35ab0..50fc30d 100644 --- a/src/common/parse_file.c +++ b/src/common/parse_file.c @@ -64,7 +64,7 @@ extern void parse_file(char * path, void (* token_to_entry) (char *, char *)) err_line_count = 0; err_line(0 == linemax, "File is empty."); char * token0 = NULL; /* For final token_to_entry() if while() stagnates. */ - char * token1; + char * token1 = NULL; char * err_val = "No value given."; while (try_fgets(err_line_line, linemax + 1, file, f_name)) { diff --git a/src/server/field_of_view.c b/src/server/field_of_view.c index afb25f5..61ebf88 100644 --- a/src/server/field_of_view.c +++ b/src/server/field_of_view.c @@ -383,7 +383,7 @@ static char * eye_to_cell(struct yx_uint8 * yx_eye, struct yx_uint8 * yx_cell, int16_t diff_x = yx_cell->x - yx_eye->x; uint8_t indent = yx_eye->y % 2; char * dir = dir_from_delta(indent, diff_y, diff_x); - char * dirs; + char * dirs = NULL; if (1 == strlen(dir)) { return strdup(dir);