From 2c67cb8b7a617d1a9ae00e29fc2983f0a3d3b68c Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 29 Nov 2000 14:41:34 +0000 Subject: [PATCH] Fix -Wuninitialized warnings. --- gdb/ChangeLog | 10 ++++++++++ gdb/kod-cisco.c | 8 ++------ gdb/varobj.c | 5 +++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f2b66f67976..f4f97458ee4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Thu Nov 30 01:14:21 2000 Andrew Cagney + + * Makefile.in (varobj.o): Delete special compile rule + suppressing -Werror flag. + * varobj.c (varobj_create): Initialize ``old_fi''. + (varobj_update): Initialize ``templist''. + + * kod-cisco.c (cisco_kod_request): Simplify allocation of + ``sync_ids'' eliminating uninitialized variable. + 2000-11-28 Mark Salter * MAINTAINERS: Add Mark Salter to Write After Approval list. diff --git a/gdb/kod-cisco.c b/gdb/kod-cisco.c index bf97d6741d6..0dffdb67fcd 100644 --- a/gdb/kod-cisco.c +++ b/gdb/kod-cisco.c @@ -112,7 +112,7 @@ cisco_kod_request (char *arg, int from_tty) int done = 0, i; int fail = 0; - char **sync_ids; + char **sync_ids = NULL; int sync_len = 0; int sync_next = 0; char *prev_id = NULL; @@ -216,12 +216,8 @@ cisco_kod_request (char *arg, int from_tty) buffer[off + 8] = '\0'; off += 9; - if (sync_len == 0) - sync_ids = (char **) xmalloc (count * sizeof (char *)); - else - sync_ids = (char **) xrealloc (sync_ids, - (sync_len + count) * sizeof (char *)); sync_len += count; + sync_ids = (char **) xrealloc (sync_ids, sync_len * sizeof (char *)); for (i = 0; i < count; ++i) { diff --git a/gdb/varobj.c b/gdb/varobj.c index 799558b8445..6528bcb89f2 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -411,7 +411,8 @@ varobj_create (char *objname, enum varobj_type type) { struct varobj *var; - struct frame_info *fi, *old_fi; + struct frame_info *fi; + struct frame_info *old_fi = NULL; struct block *block; struct cleanup *old_chain; @@ -883,7 +884,7 @@ varobj_update (struct varobj *var, struct varobj ***changelist) int error2; struct varobj *v; struct varobj **cv; - struct varobj **templist; + struct varobj **templist = NULL; value_ptr new; struct vstack *stack = NULL; struct vstack *result = NULL; -- 2.30.2