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
master
David Lawrence Ramsey 2007-10-11 15:38:32 +00:00
parent b4b553665c
commit 6e6c80b181
3 changed files with 13 additions and 11 deletions

View File

@ -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 <pooka109@gmail.com>

View File

@ -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';

View File

@ -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