From: David Lawrence Ramsey Date: Tue, 7 Feb 2006 18:32:22 +0000 (+0000) Subject: cosmetic and formatting fixes X-Git-Tag: v1.3.11~52 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=fc8e5cb0f250e2bfcd69e1ca346a9d559089211d;p=nano.git cosmetic and formatting fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3277 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index c143bb53..88e29de9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,9 @@ CVS code - - chars.c: mbstrchr() - Make parameter c const. (DLR) +- files.c: + is_dir() + - Rename parameter ret to retval, for consistency. (DLR) - utils.c: ngetdelim() - Do sanity checks manually again instead of in an assert, and diff --git a/src/files.c b/src/files.c index e61a3122..bda10d21 100644 --- a/src/files.c +++ b/src/files.c @@ -3,7 +3,7 @@ * files.c * * * * Copyright (C) 1999-2004 Chris Allegretta * - * Copyright (C) 2005 David Lawrence Ramsey * + * Copyright (C) 2005-2006 David Lawrence Ramsey * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2, or (at your option) * @@ -1954,15 +1954,14 @@ int is_dir(const char *buf) { char *dirptr = real_dir_from_tilde(buf); struct stat fileinfo; - - int ret = (stat(dirptr, &fileinfo) != -1 && + int retval = (stat(dirptr, &fileinfo) != -1 && S_ISDIR(fileinfo.st_mode)); assert(buf != NULL && dirptr != buf); free(dirptr); - return ret; + return retval; } /* These functions, username_tab_completion(), cwd_tab_completion() @@ -2078,9 +2077,8 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t #endif /* See if this matches. */ if (strncmp(nextdir->d_name, filename, filenamelen) == 0 && - (*filename == '.' || - (strcmp(nextdir->d_name, ".") != 0 && - strcmp(nextdir->d_name, "..") != 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... */ @@ -2101,8 +2099,8 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t free(tmp2); #endif - matches = (char **)nrealloc(matches, - (*num_matches + 1) * sizeof(char *)); + matches = (char **)nrealloc(matches, (*num_matches + 1) * + sizeof(char *)); matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name); ++(*num_matches); }