diff --git a/ChangeLog b/ChangeLog index 76f10fdf..95be8e55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * NEWS: Fix some typos and whitespace, and normalize the dates. * src/files.c (load_poshistory): Rename a variable. * src/files.c (load_poshistory): Remove some code duplication. + * src/files.c (save_poshistory, update_poshistory, check_poshistory, + load_poshistory): Differentiate variable name from function names. GNU nano 2.5.1 - 2016.01.11 diff --git a/src/files.c b/src/files.c index cd6d6fac..b06d46d4 100644 --- a/src/files.c +++ b/src/files.c @@ -3124,7 +3124,7 @@ void save_poshistory(void) * history file. */ chmod(poshist, S_IRUSR | S_IWUSR); - for (posptr = poshistory; posptr != NULL; posptr = posptr->next) { + for (posptr = position_history; posptr != NULL; posptr = posptr->next) { statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4); sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno, (long)posptr->xno); @@ -3149,7 +3149,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos) if (fullpath == NULL) return; - for (posptr = poshistory; posptr != NULL; posptr = posptr->next) { + for (posptr = position_history; posptr != NULL; posptr = posptr->next) { if (!strcmp(posptr->filename, fullpath)) { posptr->lineno = lineno; posptr->xno = xpos; @@ -3166,8 +3166,8 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos) posptr->xno = xpos; posptr->next = NULL; - if (!poshistory) - poshistory = posptr; + if (position_history == NULL) + position_history = posptr; else posprev->next = posptr; @@ -3185,7 +3185,7 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column) if (fullpath == NULL) return 0; - for (posptr = poshistory; posptr != NULL; posptr = posptr->next) { + for (posptr = position_history; posptr != NULL; posptr = posptr->next) { if (!strcmp(posptr->filename, fullpath)) { *line = posptr->lineno; *column = posptr->xno; @@ -3238,10 +3238,10 @@ void load_poshistory(void) newrecord->next = NULL; /* Add the record to the list. */ - if (poshistory == NULL) - poshistory = newrecord; + if (position_history == NULL) + position_history = newrecord; else { - for (posptr = poshistory; posptr->next != NULL;) + for (posptr = position_history; posptr->next != NULL;) posptr = posptr->next; posptr->next = newrecord; } diff --git a/src/global.c b/src/global.c index 294ccdbc..74860729 100644 --- a/src/global.c +++ b/src/global.c @@ -190,7 +190,7 @@ filestruct *replaceage = NULL; /* The top of the replace string history list. */ filestruct *replacebot = NULL; /* The bottom of the replace string history list. */ -poshiststruct *poshistory; +poshiststruct *position_history = NULL; /* The cursor position history list. */ #endif diff --git a/src/proto.h b/src/proto.h index 29796224..543bc823 100644 --- a/src/proto.h +++ b/src/proto.h @@ -128,7 +128,7 @@ extern filestruct *searchbot; extern filestruct *replace_history; extern filestruct *replaceage; extern filestruct *replacebot; -extern poshiststruct *poshistory; +extern poshiststruct *position_history; #endif #ifdef HAVE_REGEX_H