From 546f5b3d8a28d2fbed20983829c136f2f912fb4d Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sat, 14 May 2005 23:14:47 +0000 Subject: [PATCH] rename a few more variables, and fix some indentation git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2508 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 5 +++++ src/files.c | 35 ++++++++++++++++++----------------- src/proto.h | 12 ++++++------ src/winio.c | 6 +++--- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5720dff9..bbf3cbaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,8 @@ CVS code - write_file() - Since lineswritten is a size_t, print its value as an unsigned long instead of an unsigned int. (DLR) + cwd_tab_completion(), browser_init() + - Rename variable next to nextdir to avoid confusion. (DLR) do_browser() - Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for consistency. (DLR) @@ -52,6 +54,9 @@ CVS code - num_of_digits() - Use a size_t instead of an int, and rename to digits(). (DLR) - winio.c: + statusq() + - Rename variable which_history to history_list, for + consistency. (DLR) do_help() - Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for consistency. (DLR) diff --git a/src/files.c b/src/files.c index d299e242..e937aa52 100644 --- a/src/files.c +++ b/src/files.c @@ -2062,7 +2062,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t size_t filenamelen; char **matches = NULL; DIR *dir; - const struct dirent *next; + const struct dirent *nextdir; assert(dirname != NULL && num_matches != NULL && buflen >= 0); @@ -2102,15 +2102,16 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t #endif filenamelen = strlen(filename); - while ((next = readdir(dir)) != NULL) { + while ((nextdir = readdir(dir)) != NULL) { #ifdef DEBUG - fprintf(stderr, "Comparing \'%s\'\n", next->d_name); + fprintf(stderr, "Comparing \'%s\'\n", nextdir->d_name); #endif /* See if this matches. */ - if (strncmp(next->d_name, filename, filenamelen) == 0 && - (*filename == '.' || (strcmp(next->d_name, ".") != 0 && - strcmp(next->d_name, "..") != 0))) { + if (strncmp(nextdir->d_name, filename, filenamelen) == 0 && + (*filename == '.' || + (strcmp(nextdir->d_name, ".") != 0 && + strcmp(nextdir->d_name, "..") != 0))) { /* Cool, found a match. Add it to the list. This makes a * lot more sense to me (Chris) this way... */ @@ -2121,9 +2122,9 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t * the directory name to the beginning of the proposed match * before we check it. */ char *tmp2 = charalloc(strlen(dirname) + - strlen(next->d_name) + 1); + strlen(nextdir->d_name) + 1); - sprintf(tmp2, "%s%s", dirname, next->d_name); + sprintf(tmp2, "%s%s", dirname, nextdir->d_name); if (check_operating_dir(tmp2, TRUE)) { free(tmp2); continue; @@ -2133,7 +2134,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t matches = (char **)nrealloc(matches, (*num_matches + 1) * sizeof(char *)); - matches[*num_matches] = mallocstrcpy(NULL, next->d_name); + matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name); ++(*num_matches); } } @@ -2341,7 +2342,7 @@ void striponedir(char *path) char **browser_init(const char *path, int *longest, size_t *numents, DIR *dir) { - const struct dirent *next; + const struct dirent *nextdir; char **filelist; size_t i, path_len; @@ -2351,15 +2352,15 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR i = 0; - while ((next = readdir(dir)) != NULL) { + while ((nextdir = readdir(dir)) != NULL) { size_t dlen; /* Don't show the . entry. */ - if (strcmp(next->d_name, ".") == 0) + if (strcmp(nextdir->d_name, ".") == 0) continue; i++; - dlen = strlenpt(next->d_name); + dlen = strlenpt(nextdir->d_name); if (dlen > *longest) *longest = dlen; } @@ -2374,13 +2375,13 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR i = 0; - while ((next = readdir(dir)) != NULL && i < *numents) { + while ((nextdir = readdir(dir)) != NULL && i < *numents) { /* Don't show the "." entry. */ - if (strcmp(next->d_name, ".") == 0) + if (strcmp(nextdir->d_name, ".") == 0) continue; - filelist[i] = charalloc(path_len + strlen(next->d_name) + 1); - sprintf(filelist[i], "%s%s", path, next->d_name); + filelist[i] = charalloc(path_len + strlen(nextdir->d_name) + 1); + sprintf(filelist[i], "%s%s", path, nextdir->d_name); i++; } diff --git a/src/proto.h b/src/proto.h index c22c37f9..3e4d2fa6 100644 --- a/src/proto.h +++ b/src/proto.h @@ -649,18 +649,18 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool void nanoget_repaint(const char *buf, const char *inputbuf, size_t x); int nanogetstr(bool allow_tabs, const char *buf, const char *def, #ifndef NANO_SMALL - historyheadtype *history_list, + historyheadtype *history_list, #endif - const shortcut *s + const shortcut *s #ifndef DISABLE_TABCOMP - , bool *list + , bool *list #endif - ); + ); int statusq(bool allow_tabs, const shortcut *s, const char *def, #ifndef NANO_SMALL - historyheadtype *history_list, + historyheadtype *history_list, #endif - const char *msg, ...); + const char *msg, ...); void statusq_abort(void); void titlebar(const char *path); void set_modified(void); diff --git a/src/winio.c b/src/winio.c index 974d8364..43aba48d 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2652,9 +2652,9 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, * completion. */ int statusq(bool allow_tabs, const shortcut *s, const char *def, #ifndef NANO_SMALL - historyheadtype *which_history, + historyheadtype *history_list, #endif - const char *msg, ...) + const char *msg, ...) { va_list ap; char *foo = charalloc(((COLS - 4) * mb_cur_max()) + 1); @@ -2672,7 +2672,7 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def, ret = nanogetstr(allow_tabs, foo, def, #ifndef NANO_SMALL - which_history, + history_list, #endif s #ifndef DISABLE_TABCOMP -- 2.39.5