src/view.c: valgrind: hackish fix of uninitialised value usage

valgrind log when run viewer
==9981== Conditional jump or move depends on uninitialised value(s)
==9981==    at 0x45891B: view_map_offset_and_column (view.c:584)
==9981==    by 0x458D5B: view_column_to_offset (view.c:917)
==9981==    by 0x458DD8: view_set_first_showed (view.c:1443)
==9981==    by 0x45B79F: view_new (view.c:4136)
==9981==    by 0x45B911: mc_internal_viewer (view.c:3969)
==9981==    by 0x423D85: view_file_at_line (cmd.c:132)
==9981==    by 0x423E78: do_view_cmd (cmd.c:217)
==9981==    by 0x45CDE7: buttonbar_call (widget.c:2425)
==9981==    by 0x45D754: buttonbar_callback (widget.c:2456)
==9981==    by 0x427D42: dlg_process_event (dialog.c:618)
==9981==    by 0x428035: run_dlg (dialog.c:789)
==9981==    by 0x43E708: main (main.c:1688)
==9981==  Uninitialised value was created by a stack allocation
==9981==    at 0x4586F0: view_map_offset_and_column (view.c:593)

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This commit is contained in:
Sergei Trofimovich 2009-04-22 21:54:51 +03:00
parent 27fbf91c28
commit 725fe42290

View File

@ -593,6 +593,12 @@ view_map_offset_and_column (WView *view, struct cache_line *line,
{
const screen_dimen width = view->data_area.width;
struct read_info info;
/* HACK: valgrind screams here.
* TODO: to figure out WHY valgrind detects uninitialized
* variables. Maybe, info isn't fully initialized?
*/
memset (&info, 0, sizeof info);
offset_type nroff_start = 0;
int nroff_seq = 0;
int w;