diff --git a/ChangeLog b/ChangeLog index 5a1b76df..5830d2d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,13 +11,14 @@ CVS code - nanoget_repaint(), nanogetstr(), and statusq(). (DLR) - Since the statusbar prompt code needs at least 4 columns in order to work properly, make that the minimum number of - columns nano requires to run, and remove assertions and code - that make use of a smaller number. Changes to window_init(), - nanoget_repaint(), titlebar(), statusbar(), and - get_page_start(). (DLR) + columns that nano requires in order to run, and remove + assertions and code that make use of a smaller number of + columns. Changes to window_init(), nanoget_repaint(), + titlebar(), statusbar(), and get_page_start(). (DLR) - Move get_page_start(), xplustabs(), actual_x(), strnlenpt(), - and strlenpt() from winio.c to utils.c, as they're really - utility functions. (DLR) + strlenpt(), check_linenumbers(), dump_buffer(), and + dump_buffer_reverse() from winio.c to utils.c, as they're + really utility functions. (DLR) - Add missing stdio.h #include to winio.c. (DLR) - Move functions specific to the statusbar prompt to their own source file, adjust related variables accordingly, and rename diff --git a/src/proto.h b/src/proto.h index 2db367be..5cc30212 100644 --- a/src/proto.h +++ b/src/proto.h @@ -617,6 +617,13 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct **bot, size_t *bot_x, bool *right_side_up); #endif size_t get_totsize(const filestruct *begin, const filestruct *end); +#ifndef NDEBUG +int check_linenumbers(const filestruct *fileptr); +#endif +#ifdef DEBUG +void dump_filestruct(const filestruct *inptr); +void dump_filestruct_reverse(void); +#endif /* Public functions in winio.c. */ #ifndef NANO_SMALL @@ -689,13 +696,6 @@ void display_main_list(void); void do_cursorpos(bool constant); void do_cursorpos_void(void); void do_replace_highlight(bool highlight, const char *word); -#ifndef NDEBUG -int check_linenumbers(const filestruct *fileptr); -#endif -#ifdef DEBUG -void dump_filestruct(const filestruct *inptr); -void dump_filestruct_reverse(void); -#endif #ifdef NANO_EXTRA void do_credits(void); #endif diff --git a/src/utils.c b/src/utils.c index 169a908e..95cbdfa0 100644 --- a/src/utils.c +++ b/src/utils.c @@ -561,3 +561,49 @@ size_t get_totsize(const filestruct *begin, const filestruct *end) return totsize; } + +#ifndef NDEBUG +/* Return what the current line number should be, starting at edittop + * and ending at fileptr. */ +int check_linenumbers(const filestruct *fileptr) +{ + int check_line = 0; + const filestruct *filetmp; + + for (filetmp = openfile->edittop; filetmp != fileptr; + filetmp = filetmp->next) + check_line++; + + return check_line; +} +#endif /* !NDEBUG */ + +#ifdef DEBUG +/* Dump the filestruct inptr to stderr. */ +void dump_filestruct(const filestruct *inptr) +{ + if (inptr == openfile->fileage) + fprintf(stderr, "Dumping file buffer to stderr...\n"); + else if (inptr == cutbuffer) + fprintf(stderr, "Dumping cutbuffer to stderr...\n"); + else + fprintf(stderr, "Dumping a buffer to stderr...\n"); + + while (inptr != NULL) { + fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data); + inptr = inptr->next; + } +} + +/* Dump the current buffer's filestruct to stderr in reverse. */ +void dump_filestruct_reverse(void) +{ + const filestruct *fileptr = openfile->filebot; + + while (fileptr != NULL) { + fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno, + fileptr->data); + fileptr = fileptr->prev; + } +} +#endif /* DEBUG */ diff --git a/src/winio.c b/src/winio.c index e4ca5eb9..d05c9215 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3090,52 +3090,6 @@ void do_replace_highlight(bool highlight, const char *word) wattroff(edit, A_REVERSE); } -#ifndef NDEBUG -/* Return what the current line number should be, starting at edittop - * and ending at fileptr. */ -int check_linenumbers(const filestruct *fileptr) -{ - int check_line = 0; - const filestruct *filetmp; - - for (filetmp = openfile->edittop; filetmp != fileptr; - filetmp = filetmp->next) - check_line++; - - return check_line; -} -#endif /* !NDEBUG */ - -#ifdef DEBUG -/* Dump the filestruct inptr to stderr. */ -void dump_filestruct(const filestruct *inptr) -{ - if (inptr == openfile->fileage) - fprintf(stderr, "Dumping file buffer to stderr...\n"); - else if (inptr == cutbuffer) - fprintf(stderr, "Dumping cutbuffer to stderr...\n"); - else - fprintf(stderr, "Dumping a buffer to stderr...\n"); - - while (inptr != NULL) { - fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data); - inptr = inptr->next; - } -} - -/* Dump the current buffer's filestruct to stderr in reverse. */ -void dump_filestruct_reverse(void) -{ - const filestruct *fileptr = openfile->filebot; - - while (fileptr != NULL) { - fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno, - fileptr->data); - fileptr = fileptr->prev; - } -} -#endif /* DEBUG */ - #ifdef NANO_EXTRA #define CREDIT_LEN 54 #define XLCREDIT_LEN 8