Thread (24 messages) flat view 24 messages, 2 authors, 2016-06-15
STALE3720d

[PATCH v2 2/4] config: drop file pointer validity check in get_next_char()

From: Heiko Voigt <hidden>
Date: 2016-06-15 22:56:21
Subsystem: the rest · Maintainer: Linus Torvalds

The only location where cf is set in this file is in do_config_from().
This function has only one callsite which is config_from_file(). In
config_from_file() its ensured that the f member is set to non-zero.

Signed-off-by: Heiko Voigt <redacted>
---
 config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config.c b/config.c
index 2c299dc..f55c43d 100644
--- a/config.c
+++ b/config.c
@@ -169,10 +169,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)
 static int get_next_char(void)
 {
 	int c;
-	FILE *f;
 
 	c = '\n';
-	if (cf && ((f = cf->f) != NULL)) {
+	if (cf) {
+		FILE *f = cf->f;
 		c = fgetc(f);
 		if (c == '\r') {
 			/* DOS like systems */
-- 
1.8.2.rc0.26.gf7384c5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help