From 27e07d2af5c5411cb97fdc7b1c4384ae33cad2d0 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 23 May 2016 18:23:25 +0200
Subject: [PATCH] tweaks: rename two variables, to avoid using a name for
 different purposes

When calling do_prompt(), 'ans' is used to offer a default answer or the
answer given so far.
---
 src/files.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/files.c b/src/files.c
index c0cafd29..2f77bee5 100644
--- a/src/files.c
+++ b/src/files.c
@@ -318,7 +318,7 @@ int do_lockfile(const char *filename)
 	ssize_t readtot = 0;
 	ssize_t readamt = 0;
 	char *lockbuf, *question, *postedname, *promptstr;
-	int room, ans;
+	int room, response;
 
 	if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
 	    statusline(MILD, _("Error opening lock file %s: %s"),
@@ -370,10 +370,10 @@ int do_lockfile(const char *filename)
 	sprintf(promptstr, question, postedname, lockuser, lockprog, lockpid);
 	free(postedname);
 
-	ans = do_yesno_prompt(FALSE, promptstr);
+	response = do_yesno_prompt(FALSE, promptstr);
 	free(promptstr);
 
-	if (ans < 1) {
+	if (response < 1) {
 	    blank_statusbar();
 	    goto free_the_name;
 	}
@@ -645,7 +645,7 @@ int is_file_writable(const char *filename)
     int fd;
     FILE *f;
     char *full_filename;
-    bool ans = TRUE;
+    bool result = TRUE;
 
     if (ISSET(VIEW_MODE))
 	return TRUE;
@@ -664,13 +664,14 @@ int is_file_writable(const char *filename)
     if ((fd = open(full_filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR |
 		S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1 ||
 		(f = fdopen(fd, "a")) == NULL)
-	ans = FALSE;
+	result = FALSE;
     else
 	fclose(f);
-    close(fd);
 
+    close(fd);
     free(full_filename);
-    return ans;
+
+    return result;
 }
 
 /* Make a new line of text from the given buf, which is of length buf_len.
-- 
GitLab