1
1

tweaks: put some prototypes in the proper order, and move a bit of code

Этот коммит содержится в:
Benno Schulenberg 2016-12-15 13:04:52 +01:00
родитель d6cc2c40fe
Коммит 9fa95a3680
3 изменённых файлов: 29 добавлений и 31 удалений

Просмотреть файл

@ -588,18 +588,25 @@ void do_tab(void);
void do_indent(ssize_t cols);
void do_indent_void(void);
void do_unindent(void);
void do_undo(void);
void do_redo(void);
#endif
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
void do_comment(void);
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
#endif
void do_undo(void);
void do_redo(void);
void do_enter(void);
#ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command);
void discard_until(const undo *thisitem, openfilestruct *thefile);
void add_undo(undo_type action);
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
#endif
void update_undo(undo_type action);
#endif /* !NANO_TINY */
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
@ -688,13 +695,6 @@ void new_magicline(void);
void remove_magicline(void);
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up);
void discard_until(const undo *thisitem, openfilestruct *thefile);
void add_undo(undo_type action);
void update_undo(undo_type action);
#ifndef DISABLE_COMMENT
void update_comment_undo(ssize_t lineno);
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
#endif
#endif
size_t get_totsize(const filestruct *begin, const filestruct *end);
#ifndef NANO_TINY

Просмотреть файл

@ -981,7 +981,7 @@ void do_redo(void)
#endif /* !NANO_TINY */
/* Break the current line at the cursor position. */
void do_enter()
void do_enter(void)
{
filestruct *newnode = make_new_node(openfile->current);
size_t extra = 0;

Просмотреть файл

@ -597,27 +597,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
*right_side_up = FALSE;
}
}
#endif /* !NANO_TINY */
/* Count the number of characters from begin to end, and return it. */
size_t get_totsize(const filestruct *begin, const filestruct *end)
{
const filestruct *line;
size_t totsize = 0;
/* Sum the number of characters (plus a newline) in each line. */
for (line = begin; line != end->next; line = line->next)
totsize += mbstrlen(line->data) + 1;
/* The last line of a file doesn't have a newline -- otherwise it
* wouldn't be the last line -- so subtract 1 when at EOF. */
if (line == NULL)
totsize--;
return totsize;
}
#ifndef NANO_TINY
/* Given a line number, return a pointer to the corresponding struct. */
filestruct *fsfromline(ssize_t lineno)
{
@ -638,7 +618,25 @@ filestruct *fsfromline(ssize_t lineno)
return f;
}
#endif
#endif /* !NANO_TINY */
/* Count the number of characters from begin to end, and return it. */
size_t get_totsize(const filestruct *begin, const filestruct *end)
{
const filestruct *line;
size_t totsize = 0;
/* Sum the number of characters (plus a newline) in each line. */
for (line = begin; line != end->next; line = line->next)
totsize += mbstrlen(line->data) + 1;
/* The last line of a file doesn't have a newline -- otherwise it
* wouldn't be the last line -- so subtract 1 when at EOF. */
if (line == NULL)
totsize--;
return totsize;
}
#ifdef DEBUG
/* Dump the filestruct inptr to stderr. */