[dia] [warningectomy] variable 'ret' is used uninitialized whenever ...
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [warningectomy] variable 'ret' is used uninitialized whenever ...
- Date: Sun, 6 Apr 2014 13:35:21 +0000 (UTC)
commit 1932e5c45f0e1d0efbe0d69f936af20d488c81b7
Author: Hans Breuer <hans breuer org>
Date: Sat Apr 5 22:14:09 2014 +0200
[warningectomy] variable 'ret' is used uninitialized whenever ...
load_save.c:362:9: warning: variable 'ret' is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
if (strcmp((char *)val, "true")==0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
load_save.c:368:10: note: uninitialized use occurs here
return ret;
^~~
load_save.c:362:5: note: remove the 'if' if its condition is always true
if (strcmp((char *)val, "true")==0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
load_save.c:358:15: note: initialize the variable 'ret' to silence this warning
gboolean ret;
^
= 0
app/load_save.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/app/load_save.c b/app/load_save.c
index 64c59af..8b76f84 100644
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -359,8 +359,7 @@ _get_bool_prop (xmlNodePtr node, const char *name, gboolean preset)
xmlChar *val = xmlGetProp(node, (const xmlChar *)name);
if (val) {
- if (strcmp((char *)val, "true")==0)
- ret = TRUE;
+ ret = (strcmp((char *)val, "true")==0);
xmlFree(val);
} else {
ret = preset;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]