tweaks: drop most of the remaining debugging code, and some timing code

master
Benno Schulenberg 2019-05-08 15:00:27 +02:00
parent da91a44f9e
commit c55d144748
6 changed files with 1 additions and 67 deletions

View File

@ -355,10 +355,6 @@ void precalc_multicolorinfo(void)
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
return;
#ifdef DEBUG
fprintf(stderr, "Precalculating the multiline color info...\n");
#endif
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
/* If this is not a multi-line regex, skip it. */
if (ink->end == NULL)

View File

@ -1787,10 +1787,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
goto cleanup_and_exit;
}
#ifdef DEBUG
fprintf(stderr, "Backing up %s to %s\n", realname, backupname);
#endif
/* Copy the file. */
if (copy_file(f, backup_file, FALSE) != 0) {
fclose(backup_file);

View File

@ -378,10 +378,6 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
f->help = help;
f->blank_after = blank_after;
#endif
#ifdef DEBUG
fprintf(stderr, "Added func %ld (%s) for menus %x\n", (long)func, f->desc, menus);
#endif
}
/* Add a key combo to the shortcut list. */
@ -413,10 +409,6 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
assign_keyinfo(s, scstring, keycode);
tailsc = s;
#ifdef DEBUG
fprintf(stderr, "Setting keycode to %d for shortcut \"%s\" in menus %x\n", s->keycode, scstring, s->menus);
#endif
}
/* Return the first shortcut in the list of shortcuts that
@ -429,9 +421,6 @@ const keystruct *first_sc_for(int menu, void (*func)(void))
if ((s->menus & menu) && s->func == func)
return s;
#ifdef DEBUG
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
#endif
return NULL;
}
@ -506,22 +495,6 @@ int keycode_from_string(const char *keystring)
return -1;
}
#ifdef DEBUG
void print_sclist(void)
{
keystruct *s;
const funcstruct *f;
for (s = sclist; s != NULL; s = s->next) {
f = sctofunc(s);
if (f)
fprintf(stderr, "Shortcut \"%s\", function: %s, menus %x\n", s->keystr, f->desc, f->menus);
else
fprintf(stderr, "Hmm, didn't find a func for \"%s\"\n", s->keystr);
}
}
#endif
/* These two tags are used elsewhere too, so they are global. */
/* TRANSLATORS: Try to keep the next two strings at most 10 characters. */
const char *exit_tag = N_("Exit");
@ -1386,12 +1359,9 @@ void shortcut_init(void)
#ifdef ENABLE_SPELLER
add_to_sclist(MMAIN, "F12", 0, do_spell, 0);
#endif
#ifdef DEBUG
print_sclist();
#endif
}
/* Return something. */
const funcstruct *sctofunc(const keystruct *s)
{
funcstruct *f = allfuncs;

View File

@ -2340,11 +2340,6 @@ int main(int argc, char **argv)
(double)(clock() - start) / CLOCKS_PER_SEC);
#endif
#ifdef DEBUG
fprintf(stderr, "After rebinding keys...\n");
print_sclist();
#endif
/* If the backed-up command-line options have a value, restore them. */
#ifdef ENABLED_WRAPORJUSTIFY
if (fill_used)
@ -2539,10 +2534,6 @@ int main(int argc, char **argv)
/* Set up the terminal state. */
terminal_init();
#ifdef DEBUG
fprintf(stderr, "Main: set up windows\n");
#endif
/* Create the three subwindows, based on the current screen dimensions. */
window_init();
curs_set(0);
@ -2597,10 +2588,6 @@ int main(int argc, char **argv)
set_escdelay(50);
#endif
#ifdef DEBUG
fprintf(stderr, "Main: open file\n");
#endif
/* Read the files mentioned on the command line into new buffers. */
while (optind < argc && (!openfile || read_them_all)) {
ssize_t givenline = 0, givencol = 0;
@ -2655,10 +2642,6 @@ int main(int argc, char **argv)
on_a_vt = (ioctl(0, VT_GETSTATE, &dummy) == 0);
#endif
#ifdef DEBUG
fprintf(stderr, "Main: show title bar, and enter main loop\n");
#endif
prepare_for_display();
#ifdef ENABLE_NANORC

View File

@ -322,7 +322,6 @@ int the_code_for(void (*func)(void), int defaultval);
functionptrtype func_from_key(int *kbinput);
int keycode_from_string(const char *keystring);
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
void print_sclist(void);
void shortcut_init(void);
const funcstruct *sctofunc(const keystruct *s);
const char *flagtostr(int flag);

View File

@ -22,9 +22,6 @@
#include "proto.h"
#include <string.h>
#ifdef DEBUG
#include <time.h>
#endif
static bool came_full_circle = FALSE;
/* Have we reached the starting line again while searching? */
@ -397,9 +394,6 @@ void go_looking(void)
{
linestruct *was_current = openfile->current;
size_t was_current_x = openfile->current_x;
#ifdef DEBUG
clock_t start = clock();
#endif
came_full_circle = FALSE;
@ -414,10 +408,6 @@ void go_looking(void)
else if (didfind == 0)
not_found_msg(last_search);
#ifdef DEBUG
statusline(HUSH, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
#endif
edit_redraw(was_current, CENTERING);
}