Whitespace adjustments, plus a few comment tweaks.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4769 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2014-04-14 09:57:06 +00:00
parent 7828a8096e
commit 8f6151198a
12 changed files with 44 additions and 46 deletions

View File

@ -3,6 +3,7 @@
'file_bot' from copy_from_filestruct(), and rename the other.
* src/*: Remove the unused parameter 'func_key' from get_shortcut(),
and subsequently from parse_browser_input() and parse_help_input().
* src/*: Whitespace adjustments, plus a few comment tweaks.
2014-04-13 Benno Schulenberg <bensberg@justemail.net>
* proto.h, global.c, rcfile.c: Remove the unused parameter 'menu'

View File

@ -161,9 +161,9 @@ void color_update(void)
if (stat(openfile->filename, &fileinfo) == 0) {
m = magic_open(MAGIC_SYMLINK |
#ifdef DEBUG
MAGIC_DEBUG | MAGIC_CHECK |
MAGIC_DEBUG | MAGIC_CHECK |
#endif
MAGIC_ERROR);
MAGIC_ERROR);
if (m == NULL || magic_load(m, NULL) < 0)
statusbar(_("magic_load() failed: %s"), strerror(errno));
else {
@ -171,7 +171,7 @@ void color_update(void)
if (magicstring == NULL) {
magicerr = magic_error(m);
statusbar(_("magic_file(%s) failed: %s"), openfile->filename, magicerr);
}
}
#ifdef DEBUG
fprintf(stderr, "magic string returned: %s\n", magicstring);
#endif
@ -395,8 +395,8 @@ void reset_multis(filestruct *fileptr, bool force)
/* Figure out where the first begin and end are to determine if
* things changed drastically for the precalculated multi values. */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) {
if (nobegin && noend)
continue;

View File

@ -125,7 +125,7 @@ void do_cut_text(
* it. */
size_t cb_save_len = 0;
/* The length of the string at the current end of the cutbuffer,
* before we add text to it. */
* before we add text to it. */
bool old_no_newlines = ISSET(NO_NEWLINES);
#endif
@ -264,7 +264,7 @@ void do_uncut_text(void)
return;
#ifndef NANO_TINY
update_undo(UNCUT);
update_undo(UNCUT);
#endif
/* Add a copy of the text in the cutbuffer to the current filestruct

View File

@ -1476,11 +1476,11 @@ char *safe_tempfile(FILE **f)
/* If $TMPDIR is unset, empty, or not a writable directory, and
* full_tempdir is NULL, try P_tmpdir instead. */
if (full_tempdir == NULL)
if (full_tempdir == NULL)
full_tempdir = check_writable_directory(P_tmpdir);
/* if P_tmpdir is NULL, use /tmp. */
if (full_tempdir == NULL)
/* if P_tmpdir is NULL, use /tmp. */
if (full_tempdir == NULL)
full_tempdir = mallocstrcpy(NULL, "/tmp/");
full_tempdir = charealloc(full_tempdir, strlen(full_tempdir) + 12);

View File

@ -47,8 +47,8 @@ void do_help(void (*refresh_func)(void))
/* The line number in help_text of the last help line. This
* variable is zero-based. */
#ifndef DISABLE_MOUSE
/* The current shortcut list. */
int oldmenu = currmenu;
/* The menu we were called from. */
#endif
const char *ptr;
/* The current line of the help text. */
@ -129,11 +129,10 @@ void do_help(void (*refresh_func)(void))
kbinput = get_kbinput(edit, &meta_key, &func_key);
#ifndef DISABLE_MOUSE
if (kbinput == KEY_MOUSE) {
if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
get_mouseinput(&mouse_x, &mouse_y, TRUE);
continue;
/* Redraw the screen. */
continue; /* Redraw the screen. */
}
#endif
@ -141,7 +140,7 @@ void do_help(void (*refresh_func)(void))
s = get_shortcut(MHELP, &kbinput, &meta_key);
if (!s)
continue;
f = sctofunc((sc *) s);
f = sctofunc((sc *) s);
if (!f)
continue;
@ -388,7 +387,7 @@ void help_init(void)
* which fill 24 columns, plus translated text, plus one or two
* \n's. */
for (f = allfuncs; f != NULL; f = f->next)
if (f->menus & currmenu)
if (f->menus & currmenu)
allocsize += (24 * mb_cur_max()) + strlen(f->help) + 2;
#ifndef NANO_TINY
@ -399,7 +398,7 @@ void help_init(void)
size_t endis_len = strlen(_("enable/disable"));
for (s = sclist; s != NULL; s = s->next)
if (s->scfunc == do_toggle_void)
if (s->scfunc == do_toggle_void)
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9;
}
@ -425,26 +424,26 @@ void help_init(void)
/* Now add our shortcut info. */
for (f = allfuncs; f != NULL; f = f->next) {
if ((f->menus & currmenu) == 0)
if ((f->menus & currmenu) == 0)
continue;
if (!f->desc || !strcmp(f->desc, ""))
if (!f->desc || !strcmp(f->desc, ""))
continue;
/* Let's just try and use the first 3 shortcuts from the new
* struct... */
for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
/* Let's just try and use the first 3 shortcuts from the new
* struct... */
for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
if (scsfound == 3)
if (scsfound == 3)
continue;
if (s->type == RAWINPUT)
if (s->type == RAWINPUT)
continue;
if ((s->menu & currmenu) == 0)
continue;
if (s->scfunc == f->scfunc) {
if (s->scfunc == f->scfunc) {
scsfound++;
if (scsfound == 1)
@ -455,7 +454,7 @@ void help_init(void)
}
}
/* Pad with tabs if we didn't find 3. */
for (; scsfound < 3; scsfound++) {
for (; scsfound < 3; scsfound++) {
*(ptr++) = '\t';
}
@ -469,8 +468,8 @@ void help_init(void)
#ifndef NANO_TINY
/* And the toggles... */
if (currmenu == MMAIN)
for (s = sclist; s != NULL; s = s->next)
if (s->scfunc == do_toggle_void)
for (s = sclist; s != NULL; s = s->next)
if (s->scfunc == do_toggle_void)
ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));

View File

@ -214,7 +214,7 @@ typedef struct colortype {
/* The compiled end (if any) of the regex string. */
struct colortype *next;
/* Next set of colors. */
int id;
int id;
/* Basic id for assigning to lines later. */
} colortype;

View File

@ -1278,7 +1278,7 @@ int do_yesno_prompt(bool all, const char *msg)
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
wattroff(bottomwin, reverse_attr);
wattroff(bottomwin, reverse_attr);
/* Refresh the edit window and the statusbar before getting
* input. */

View File

@ -454,7 +454,7 @@ int check_bad_binding(sc *s)
int i;
for (i = 0; i < BADLISTLEN; i++)
if (s->type == badtypes[i] && s->seq == badseqs[i])
if (s->type == badtypes[i] && s->seq == badseqs[i])
return 1;
return 0;
@ -563,7 +563,7 @@ void parse_binding(char *ptr, bool dobind)
/* Now find and delete any existing same shortcut in the menu(s). */
for (s = sclist; s != NULL; s = s->next) {
if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) {
if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) {
#ifdef DEBUG
fprintf(stderr, "deleting entry from menu %x\n", s->menu);
#endif

View File

@ -307,10 +307,10 @@ bool findnextstr(
/* Look for needle in the current line we're searching. */
enable_nodelay();
while (TRUE) {
if (time(NULL) - lastkbcheck > 1) {
lastkbcheck = time(NULL);
if (time(NULL) - lastkbcheck > 1) {
lastkbcheck = time(NULL);
f = getfuncfromkey(edit);
if (f && f->scfunc == do_cancel) {
if (f && f->scfunc == do_cancel) {
statusbar(_("Cancelled"));
return FALSE;
}
@ -361,7 +361,7 @@ bool findnextstr(
/* We've finished processing the file, so get out. */
if (search_last_line) {
not_found_msg(needle);
disable_nodelay();
disable_nodelay();
return FALSE;
}
@ -580,7 +580,7 @@ void do_research(void)
#endif
}
} else
statusbar(_("No current search pattern"));
statusbar(_("No current search pattern"));
openfile->placewewant = xplustabs();
edit_redraw(fileptr, pww_save);

View File

@ -550,12 +550,11 @@ void do_undo(void)
u->strdata = f->data;
f->data = data;
break;
default:
undidmsg = _("Internal error: unknown type. Please save your work.");
break;
}
renumber(f);
do_gotolinecolumn(u->lineno, u->begin, FALSE, FALSE, FALSE, TRUE);
statusbar(_("Undid action (%s)"), undidmsg);
@ -669,14 +668,13 @@ void do_redo(void)
default:
undidmsg = _("Internal error: unknown type. Please save your work.");
break;
}
do_gotolinecolumn(u->lineno, u->begin, FALSE, FALSE, FALSE, TRUE);
statusbar(_("Redid action (%s)"), undidmsg);
openfile->current_undo = u;
openfile->last_action = OTHER;
}
#endif /* !NANO_TINY */
@ -1361,7 +1359,7 @@ ssize_t break_line(const char *line, ssize_t goal
{
ssize_t blank_loc = -1;
/* Current tentative return value. Index of the last blank we
* found with short enough display width. */
* found with short enough display width. */
ssize_t cur_loc = 0;
/* Current index in line. */
size_t cur_pos = 0;

View File

@ -259,8 +259,8 @@ bool regexp_bol_or_eol(const regex_t *preg, const char *string)
REG_NOMATCH);
}
/* Fix the regex if we're on platforms which requires an adjustment
* from GNU-style to BSD-style word boundaries. */
/* Fix the regex if we're on platforms which require an adjustment
* from GNU-style to BSD-style word boundaries. */
const char *fixbounds(const char *r) {
#ifndef GNU_WORDBOUNDS
int i, j = 0;

View File

@ -2496,13 +2496,13 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *tmpcolor = openfile->colorstrings;
/* Set up multi-line color data for this line if it's not yet calculated */
/* Set up multi-line color data for this line if it's not yet calculated. */
if (fileptr->multidata == NULL && openfile->syntax
&& openfile->syntax->nmultis > 0) {
int i;
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
fileptr->multidata[i] = -1; /* Assue this applies until we know otherwise */
fileptr->multidata[i] = -1; /* Assume this applies until we know otherwise. */
}
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
int x_start;