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
Этот коммит содержится в:
родитель
b4b553665c
Коммит
6e6c80b181
@ -7,6 +7,8 @@
|
|||||||
* doc/man/nanorc.5, doc/man/fr/nanorc.5: Make copyright notices
|
* doc/man/nanorc.5, doc/man/fr/nanorc.5: Make copyright notices
|
||||||
for these files consistent in style.
|
for these files consistent in style.
|
||||||
* files.c (cwd_tab_completion): Remove unneeded assert.
|
* 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>
|
2007-10-05 David Lawrence Ramsey <pooka109@gmail.com>
|
||||||
|
|
||||||
|
18
src/files.c
18
src/files.c
@ -2144,20 +2144,20 @@ bool is_dir(const char *buf)
|
|||||||
* This code is 'as is' with no warranty.
|
* This code is 'as is' with no warranty.
|
||||||
* This code may safely be consumed by a BSD or GPL license. */
|
* 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. */
|
* completion. */
|
||||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||||
size_t buflen)
|
size_t buf_len)
|
||||||
{
|
{
|
||||||
char **matches = NULL;
|
char **matches = NULL;
|
||||||
const struct passwd *userdata;
|
const struct passwd *userdata;
|
||||||
|
|
||||||
assert(buf != NULL && num_matches != NULL && buflen > 0);
|
assert(buf != NULL && num_matches != NULL && buf_len > 0);
|
||||||
|
|
||||||
*num_matches = 0;
|
*num_matches = 0;
|
||||||
|
|
||||||
while ((userdata = getpwent()) != NULL) {
|
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
|
/* Cool, found a match. Add it to the list. This makes a
|
||||||
* lot more sense to me (Chris) this way... */
|
* 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;
|
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. */
|
* completion. */
|
||||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
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;
|
char *dirname = mallocstrcpy(NULL, buf), *filename;
|
||||||
#ifndef DISABLE_OPERATINGDIR
|
#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);
|
assert(dirname != NULL && num_matches != NULL);
|
||||||
|
|
||||||
*num_matches = 0;
|
*num_matches = 0;
|
||||||
null_at(&dirname, buflen);
|
null_at(&dirname, buf_len);
|
||||||
|
|
||||||
/* Okie, if there's a / in the buffer, strip out the directory
|
/* Okie, if there's a / in the buffer, strip out the directory
|
||||||
* part. */
|
* part. */
|
||||||
@ -2516,10 +2516,10 @@ void load_history(void)
|
|||||||
* Assume the last history entry is a blank line. */
|
* Assume the last history entry is a blank line. */
|
||||||
filestruct **history = &search_history;
|
filestruct **history = &search_history;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t buflen = 0;
|
size_t buf_len = 0;
|
||||||
ssize_t read;
|
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') {
|
if (read > 0 && line[read - 1] == '\n') {
|
||||||
read--;
|
read--;
|
||||||
line[read] = '\0';
|
line[read] = '\0';
|
||||||
|
@ -326,9 +326,9 @@ void free_chararray(char **array, size_t len);
|
|||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
bool is_dir(const char *buf);
|
bool is_dir(const char *buf);
|
||||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
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
|
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
|
char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||||
*lastwastab, void (*refresh_func)(void), bool *list);
|
*lastwastab, void (*refresh_func)(void), bool *list);
|
||||||
#endif
|
#endif
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user