From 6e6c80b1812a7504c9f415bb4326a48a98128149 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 11 Oct 2007 15:38:32 +0000 Subject: [PATCH] in username_tab_completion() and cwd_tab_completion(), rename variable buflen to buf_len, for consistency git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4175 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/files.c | 18 +++++++++--------- src/proto.h | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c276e3dd..7122d446 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ * doc/man/nanorc.5, doc/man/fr/nanorc.5: Make copyright notices for these files consistent in style. * files.c (cwd_tab_completion): Remove unneeded assert. + * files.c (username_tab_completion, cwd_tab_completion): Rename + variable buflen to buf_len, for consistency. 2007-10-05 David Lawrence Ramsey diff --git a/src/files.c b/src/files.c index 1907b87a..bc6b9e3d 100644 --- a/src/files.c +++ b/src/files.c @@ -2144,20 +2144,20 @@ bool is_dir(const char *buf) * This code is 'as is' with no warranty. * This code may safely be consumed by a BSD or GPL license. */ -/* We consider the first buflen characters of buf for ~username tab +/* We consider the first buf_len characters of buf for ~username tab * completion. */ char **username_tab_completion(const char *buf, size_t *num_matches, - size_t buflen) + size_t buf_len) { char **matches = NULL; const struct passwd *userdata; - assert(buf != NULL && num_matches != NULL && buflen > 0); + assert(buf != NULL && num_matches != NULL && buf_len > 0); *num_matches = 0; while ((userdata = getpwent()) != NULL) { - if (strncmp(userdata->pw_name, buf + 1, buflen - 1) == 0) { + if (strncmp(userdata->pw_name, buf + 1, buf_len - 1) == 0) { /* Cool, found a match. Add it to the list. This makes a * lot more sense to me (Chris) this way... */ @@ -2181,10 +2181,10 @@ char **username_tab_completion(const char *buf, size_t *num_matches, return matches; } -/* We consider the first buflen characters of buf for filename tab +/* We consider the first buf_len characters of buf for filename tab * completion. */ char **cwd_tab_completion(const char *buf, bool allow_files, size_t - *num_matches, size_t buflen) + *num_matches, size_t buf_len) { char *dirname = mallocstrcpy(NULL, buf), *filename; #ifndef DISABLE_OPERATINGDIR @@ -2198,7 +2198,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t assert(dirname != NULL && num_matches != NULL); *num_matches = 0; - null_at(&dirname, buflen); + null_at(&dirname, buf_len); /* Okie, if there's a / in the buffer, strip out the directory * part. */ @@ -2516,10 +2516,10 @@ void load_history(void) * Assume the last history entry is a blank line. */ filestruct **history = &search_history; char *line = NULL; - size_t buflen = 0; + size_t buf_len = 0; ssize_t read; - while ((read = getline(&line, &buflen, hist)) >= 0) { + while ((read = getline(&line, &buf_len, hist)) >= 0) { if (read > 0 && line[read - 1] == '\n') { read--; line[read] = '\0'; diff --git a/src/proto.h b/src/proto.h index efa2332c..0508d377 100644 --- a/src/proto.h +++ b/src/proto.h @@ -326,9 +326,9 @@ void free_chararray(char **array, size_t len); #ifndef DISABLE_TABCOMP bool is_dir(const char *buf); char **username_tab_completion(const char *buf, size_t *num_matches, - size_t buflen); + size_t buf_len); char **cwd_tab_completion(const char *buf, bool allow_files, size_t - *num_matches, size_t buflen); + *num_matches, size_t buf_len); char *input_tab(char *buf, bool allow_files, size_t *place, bool *lastwastab, void (*refresh_func)(void), bool *list); #endif -- 2.39.5