mirror of git://git.sv.gnu.org/nano.git
cut down on redundant inclusions of <sys/types.h>, 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
This commit is contained in:
parent
fb8bf40efb
commit
fd3039a8e7
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
15
src/nano.c
15
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;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
/* Externs. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
|
|
@ -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>
|
||||
|
|
24
src/search.c
24
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++;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue