commit 21e307e8206a2fab772495d474023474343162e8
parent dbcf4f0cbef7134685c571a5e4b49830a2432068
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 16 Sep 2019 17:24:49 +0200
tweaks: rename a variable, normalize a comment, and reshuffle a free()
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/color.c b/src/color.c
@@ -192,14 +192,14 @@ void color_update(void)
/* If no syntax-override string was specified, or it didn't match,
* try finding a syntax based on the filename (extension). */
if (sint == NULL && !inhelp) {
- char *reserved = charalloc(PATH_MAX + 1);
- char *currentdir = getcwd(reserved, PATH_MAX + 1);
+ char *reservation = charalloc(PATH_MAX + 1);
+ char *currentdir = getcwd(reservation, PATH_MAX + 1);
char *joinednames = charalloc(PATH_MAX + 1);
char *fullname = NULL;
+ /* When the specified filename is not absolute, concatenate it
+ * with the working directory and canonicalize the result. */
if (currentdir != NULL && openfile->filename[0] != '/') {
- /* Concatenate the current working directory with the
- * specified filename, and canonicalize the result. */
sprintf(joinednames, "%s/%s", currentdir, openfile->filename);
fullname = get_full_path(joinednames);
}
@@ -212,9 +212,9 @@ void color_update(void)
break;
}
- free(joinednames);
free(fullname);
- free(reserved);
+ free(joinednames);
+ free(reservation);
}
/* If the filename didn't match anything, try the first line. */