From: David Lawrence Ramsey Date: Sat, 17 Jul 2004 19:49:12 +0000 (+0000) Subject: cut down on redundant inclusions of , include it in proto.h X-Git-Tag: v1.3.4~49 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=fd3039a8e7d5e7aa1387966e610f3dca9b814301;p=nano.git cut down on redundant inclusions of , include it in proto.h per DB's patch, and make a few more minor cosmetic cleanups git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1857 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index eb365fbf..7aff832b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,8 @@ CVS code - tabsize value is handled. - Remove several unnecessary reset_cursor() calls. (David Benbennick) + - Include in proto.h. (David Benbennick) DLR: + Remove some redundant inclusions of elsewhere. - files.c: close_open_file() - Tweak to no longer rely on the return values of diff --git a/src/color.c b/src/color.c index 7ad223e6..8549f0b0 100644 --- a/src/color.c +++ b/src/color.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include "proto.h" diff --git a/src/files.c b/src/files.c index d7910607..16fd95ba 100644 --- a/src/files.c +++ b/src/files.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -2080,7 +2079,7 @@ char **username_tab_completion(char *buf, int *num_matches) matchline = charalloc(strlen(userdata->pw_name) + 2); sprintf(matchline, "~%s", userdata->pw_name); matches[*num_matches] = matchline; - ++*num_matches; + ++(*num_matches); /* If there's no more room, bail out */ if (*num_matches == BUFSIZ) diff --git a/src/nano.c b/src/nano.c index a8bc1b33..d280bc9e 100644 --- a/src/nano.c +++ b/src/nano.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -1262,13 +1261,13 @@ int do_wrap(filestruct *inptr) #ifndef NANO_SMALL const char *indentation = NULL; /* Indentation to prepend to the new line. */ - size_t indent_len = 0; /* strlen(indentation) */ + size_t indent_len = 0; /* strlen(indentation) */ #endif const char *after_break; /* Text after the wrap point. */ size_t after_break_len; /* strlen(after_break) */ int wrapping = FALSE; /* Do we prepend to the next line? */ const char *wrap_line = NULL; - /* The next line, minus indentation */ + /* The next line, minus indentation. */ size_t wrap_line_len = 0; /* strlen(wrap_line) */ char *newline = NULL; /* The line we create. */ size_t new_line_len = 0; /* Eventual length of newline. */ @@ -1276,7 +1275,7 @@ int do_wrap(filestruct *inptr) /* There are three steps. First, we decide where to wrap. Then, we * create the new wrap line. Finally, we clean up. */ -/* Step 1, finding where to wrap. We are going to add a new-line +/* Step 1, finding where to wrap. We are going to add a new line * after a whitespace character. In this step, we set wrap_loc as the * location of this replacement. * @@ -1412,7 +1411,7 @@ int do_wrap(filestruct *inptr) /* Step 3, clean up. Here we reposition the cursor and mark, and do * some other sundry things. */ - /* later wraps of this line will be prepended to the next line. */ + /* Later wraps of this line will be prepended to the next line. */ same_line_wrap = TRUE; /* Each line knows its line number. We recalculate these if we @@ -1433,8 +1432,8 @@ int do_wrap(filestruct *inptr) } #ifndef NANO_SMALL - /* If the mark was on this line after the wrap point, we move it down. - * If it was on the next line and we wrapped, we must move it + /* If the mark was on this line after the wrap point, we move it + * down. If it was on the next line and we wrapped, we move it * right. */ if (mark_beginbuf == inptr && mark_beginx > wrap_loc) { mark_beginbuf = inptr->next; @@ -1981,7 +1980,7 @@ size_t quote_length(const char *line) size_t qdepth = 0; size_t qlen = strlen(quotestr); - /* Compute quote depth level */ + /* Compute quote depth level. */ while (!strcmp(line + qdepth, quotestr)) qdepth += qlen; return qdepth; diff --git a/src/proto.h b/src/proto.h index 810cc43c..32ac4855 100644 --- a/src/proto.h +++ b/src/proto.h @@ -22,6 +22,7 @@ /* Externs. */ #include +#include #ifdef HAVE_REGEX_H #include #endif diff --git a/src/rcfile.c b/src/rcfile.c index 242d5007..e8ad3071 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/search.c b/src/search.c index 63900db4..df0f0040 100644 --- a/src/search.c +++ b/src/search.c @@ -406,8 +406,10 @@ void do_search(void) * that we find one only once per line. We should only end up * back at the same position if the string isn't found again, in * which case it's the only occurrence. */ - if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp, last_search)) { - didfind = findnextstr(TRUE, FALSE, current, current_x, answer, TRUE); + if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp, + last_search)) { + didfind = findnextstr(TRUE, FALSE, current, current_x, + answer, TRUE); if (fileptr == current && fileptr_x == current_x && !didfind) statusbar(_("This is the only occurrence")); } else { @@ -445,7 +447,8 @@ void do_research(void) #endif search_last_line = FALSE; - didfind = findnextstr(TRUE, FALSE, current, current_x, last_search, FALSE); + didfind = findnextstr(TRUE, FALSE, current, current_x, + last_search, FALSE); /* Check to see if there's only one occurrence of the string and * we're on it now. */ @@ -456,8 +459,10 @@ void do_research(void) * "^$"), so that we find one only once per line. We should * only end up back at the same position if the string isn't * found again, in which case it's the only occurrence. */ - if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp, last_search)) { - didfind = findnextstr(TRUE, FALSE, current, current_x, answer, TRUE); + if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp, + last_search)) { + didfind = findnextstr(TRUE, FALSE, current, current_x, + answer, TRUE); if (fileptr == current && fileptr_x == current_x && !didfind) statusbar(_("This is the only occurrence")); } else { @@ -922,11 +927,13 @@ void do_find_bracket(void) /* Apparent near redundancy with regexp_pat[] here is needed. * "[][]" works, "[[]]" doesn't. */ - if (pos < brackets + (strlen(brackets) / 2)) { /* On a left bracket. */ + if (pos < brackets + (strlen(brackets) / 2)) { + /* On a left bracket. */ regexp_pat[1] = wanted_ch; regexp_pat[2] = ch_under_cursor; UNSET(REVERSE_SEARCH); - } else { /* On a right bracket. */ + } else { + /* On a right bracket. */ regexp_pat[1] = ch_under_cursor; regexp_pat[2] = wanted_ch; SET(REVERSE_SEARCH); @@ -938,7 +945,8 @@ void do_find_bracket(void) search_last_line = FALSE; while (TRUE) { - if (findnextstr(FALSE, FALSE, current, current_x, regexp_pat, FALSE) != 0) { + if (findnextstr(FALSE, FALSE, current, current_x, regexp_pat, + FALSE) != 0) { /* Found identical bracket. */ if (current->data[current_x] == ch_under_cursor) count++; diff --git a/src/winio.c b/src/winio.c index 95c40800..fbe00f14 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2183,7 +2183,6 @@ void reset_cursor(void) current_y = current->lineno - edittop->lineno; if (current_y < editwinrows) { size_t x = xplustabs(); - wmove(edit, current_y, x - get_page_start(x)); } } @@ -3212,7 +3211,7 @@ void dump_buffer_reverse(void) const filestruct *fileptr = filebot; while (fileptr != NULL) { - fprintf(stderr, "(%d) %s\n", fileptr->lineno, fileptr->data); + fprintf(stderr, "(%lu) %s\n", (unsigned long)fileptr->lineno, fileptr->data); fileptr = fileptr->prev; } }