diff --git a/ChangeLog b/ChangeLog index eb365fbf2b33a3d23cd4316cbf281061d646dd47..7aff832b8d8999444c33ea9748944fd5e3afeaa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,8 @@ CVS code - tabsize value is handled. - Remove several unnecessary reset_cursor() calls. (David Benbennick) + - Include <sys/types.h> in proto.h. (David Benbennick) DLR: + Remove some redundant inclusions of <sys/types.h> 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 7ad223e6ef76e34dbb6792d53209b0c8f267e7cf..8549f0b0860460b591191b5997fd5de87fca12b3 100644 --- a/src/color.c +++ b/src/color.c @@ -25,7 +25,6 @@ #include <string.h> #include <stdio.h> #include <errno.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include "proto.h" diff --git a/src/files.c b/src/files.c index d79106072443b7bd7518d26ce5836817737e6705..16fd95ba7a906bea87690af606f5c4fa08a64c08 100644 --- a/src/files.c +++ b/src/files.c @@ -25,7 +25,6 @@ #include <string.h> #include <stdio.h> #include <unistd.h> -#include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> #include <utime.h> @@ -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 a8bc1b33a6b137f4c20a181cee21ba43f0b0fbb7..d280bc9e23b743d4c3b97596ff88e6136a05da07 100644 --- a/src/nano.c +++ b/src/nano.c @@ -31,7 +31,6 @@ #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/param.h> -#include <sys/types.h> #include <sys/wait.h> #include <errno.h> #include <ctype.h> @@ -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 810cc43c4c4080806d6c3e05426d32f5b84f5c97..32ac485521c6395cf75cc8d74090ed33c7b2bbfa 100644 --- a/src/proto.h +++ b/src/proto.h @@ -22,6 +22,7 @@ /* Externs. */ #include <sys/stat.h> +#include <sys/types.h> #ifdef HAVE_REGEX_H #include <regex.h> #endif diff --git a/src/rcfile.c b/src/rcfile.c index 242d500710b6701131fc41a19e893f8c3867493b..e8ad3071efb73768c048228f24705135b867fcad 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -27,7 +27,6 @@ #include <stdio.h> #include <errno.h> #include <unistd.h> -#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <pwd.h> diff --git a/src/search.c b/src/search.c index 63900db4656da0de980ee1e9466d76fa9ace4e6b..df0f004044e83fb6a5cf9e22a268b5f7561692e2 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 95c40800fcb84f9c6924c97618da4fec7446e09d..fbe00f146220b9ff03edc1cb2349476a9b741f9e 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; } }