tweaks: discard some obsolete debugging stuff

master
Benno Schulenberg 2017-09-14 21:57:12 +02:00
parent b27ab4f0a1
commit 7c3c3cbb3b
9 changed files with 6 additions and 85 deletions

View File

@ -125,9 +125,6 @@ void color_init(void)
background = COLOR_BLACK;
init_pair(ink->pairnum, foreground, background);
#ifdef DEBUG
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", foreground, background);
#endif
}
have_palette = TRUE;
@ -211,9 +208,6 @@ void color_update(void)
/* If the filename didn't match anything, try the first line. */
if (sint == NULL) {
#ifdef DEBUG
fprintf(stderr, "No result from file extension, trying headerline...\n");
#endif
for (sint = syntaxes; sint != NULL; sint = sint->next) {
if (found_in_list(sint->headers, openfile->fileage->data))
break;
@ -226,9 +220,7 @@ void color_update(void)
struct stat fileinfo;
magic_t cookie = NULL;
const char *magicstring = NULL;
#ifdef DEBUG
fprintf(stderr, "No result from headerline either, trying libmagic...\n");
#endif
if (stat(openfile->filename, &fileinfo) == 0) {
/* Open the magic database and get a diagnosis of the file. */
cookie = magic_open(MAGIC_SYMLINK |
@ -243,9 +235,6 @@ void color_update(void)
if (magicstring == NULL)
statusline(ALERT, _("magic_file(%s) failed: %s"),
openfile->filename, magic_error(cookie));
#ifdef DEBUG
fprintf(stderr, "Returned magic string is: %s\n", magicstring);
#endif
}
}

View File

@ -129,9 +129,6 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
if (!keep_cutbuffer) {
free_filestruct(cutbuffer);
cutbuffer = NULL;
#ifdef DEBUG
fprintf(stderr, "Blew away cutbuffer =)\n");
#endif
/* Indicate that future cuts should add to the cutbuffer. */
keep_cutbuffer = TRUE;
}

View File

@ -264,10 +264,6 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
goto free_the_data;
}
#ifdef DEBUG
fprintf(stderr, "In write_lockfile(), write successful (wrote %lu bytes)\n", (unsigned long)wroteamt);
#endif
if (fclose(filestream) == EOF) {
statusline(MILD, _("Error writing lock file %s: %s"),
lockfilename, strerror(errno));
@ -314,10 +310,7 @@ int do_lockfile(const char *filename)
snprintf(lockfilename, locknamesize, "%s/%s%s%s", dirname(namecopy),
locking_prefix, basename(secondcopy), locking_suffix);
free(secondcopy);
#ifdef DEBUG
fprintf(stderr, "lock file name is %s\n", lockfilename);
#endif
if (stat(lockfilename, &fileinfo) != -1) {
size_t readtot = 0;
size_t readamt = 0;
@ -354,11 +347,6 @@ int do_lockfile(const char *filename)
pidstring = charalloc(11);
sprintf (pidstring, "%u", (unsigned int)lockpid);
#ifdef DEBUG
fprintf(stderr, "lockpid = %d\n", lockpid);
fprintf(stderr, "program name which created this lock file should be %s\n", lockprog);
fprintf(stderr, "user which created this lock file should be %s\n", lockuser);
#endif
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
question = _("File %s is being edited (by %s with %s, PID %s); continue?");
room = COLS - strlenpt(question) + 7 - strlenpt(lockuser) -
@ -395,6 +383,7 @@ int do_lockfile(const char *filename)
free_the_name:
free(namecopy);
free(secondcopy);
if (retval < 1)
free(lockfilename);
@ -610,10 +599,6 @@ void switch_to_adjacent_buffer(bool to_next)
/* Switch to the next or previous file buffer. */
openfile = to_next ? openfile->next : openfile->prev;
#ifdef DEBUG
fprintf(stderr, "filename is %s\n", openfile->filename);
#endif
#ifndef NANO_TINY
/* When not in softwrap mode, make sure firstcolumn is zero. It might
* be nonzero if we had softwrap mode on while in this buffer, and then
@ -2151,10 +2136,6 @@ int do_writeout(bool exiting)
continue;
}
#ifdef DEBUG
fprintf(stderr, "filename is %s\n", answer);
#endif
#ifndef DISABLE_EXTRA
/* If the current file has been modified, we've pressed
* Ctrl-X at the edit window to exit, we've pressed "y" at
@ -2494,9 +2475,6 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
while ((nextdir = readdir(dir)) != NULL) {
bool skip_match = FALSE;
#ifdef DEBUG
fprintf(stderr, "Comparing \'%s\'\n", nextdir->d_name);
#endif
/* See if this matches. */
if (strncmp(nextdir->d_name, filename, filenamelen) == 0 &&
(*filename == '.' || (strcmp(nextdir->d_name, ".") != 0 &&

View File

@ -1769,10 +1769,6 @@ int do_mouse(void)
#endif
leftedge = get_page_start(xplustabs());
#ifdef DEBUG
fprintf(stderr, "mouse_row = %d, current_y = %ld\n", mouse_row, (long)openfile->current_y);
#endif
/* Move current up or down to the row corresponding to mouse_row. */
if (row_count < 0)
go_back_chunks(-row_count, &openfile->current, &leftedge);

View File

@ -470,10 +470,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
if (statusbar_x > strlen(answer))
statusbar_x = strlen(answer);
#ifdef DEBUG
fprintf(stderr, "acquiring: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
#endif
update_the_statusbar();
while (TRUE) {
@ -668,10 +664,6 @@ int do_prompt(bool allow_tabs, bool allow_files,
blank_statusbar();
wnoutrefresh(bottomwin);
#ifdef DEBUG
fprintf(stderr, "answer = \"%s\"\n", answer);
#endif
#ifdef ENABLE_TABCOMP
/* If we've done tab completion, there might still be a list of
* filename matches on the edit window. Clear them off. */

View File

@ -448,14 +448,6 @@ void parse_binding(char *ptr, bool dobind)
goto free_things;
}
#ifdef DEBUG
if (dobind)
fprintf(stderr, "newsc address is now %ld, assigned func = %ld, menu = %x\n",
(long)&newsc, (long)newsc->scfunc, menu);
else
fprintf(stderr, "unbinding \"%s\" from menu %x\n", keycopy, menu);
#endif
if (dobind) {
subnfunc *f;
int mask = 0;
@ -490,21 +482,13 @@ void parse_binding(char *ptr, bool dobind)
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
goto free_things;
}
#ifdef DEBUG
fprintf(stderr, "s->keystr = \"%s\"\n", newsc->keystr);
fprintf(stderr, "s->keycode = \"%d\"\n", newsc->keycode);
#endif
}
/* Now find and delete any existing same shortcut in the menu(s). */
for (s = sclist; s != NULL; s = s->next) {
if ((s->menus & menu) && !strcmp(s->keystr, keycopy)) {
#ifdef DEBUG
fprintf(stderr, "deleting entry from among menus %x\n", s->menus);
#endif
if ((s->menus & menu) && !strcmp(s->keystr, keycopy))
s->menus &= ~menu;
}
}
if (dobind) {
#ifndef NANO_TINY
@ -1225,7 +1209,6 @@ void parse_one_nanorc(void)
#ifdef DEBUG
fprintf(stderr, "Going to parse file \"%s\"\n", nanorc);
#endif
rcstream = fopen(nanorc, "rb");
/* If opening the file succeeded, parse it. Otherwise, only

View File

@ -1350,10 +1350,6 @@ void add_undo(undo_type action)
break;
}
#ifdef DEBUG
fprintf(stderr, " >> openfile->current->data = \"%s\", current_x = %lu, u->begin = %lu, type = %d\n",
openfile->current->data, (unsigned long)openfile->current_x, (unsigned long)u->begin, action);
#endif
openfile->last_action = action;
}

View File

@ -179,10 +179,6 @@ const char *fixbounds(const char *r)
char *r2 = charalloc(strlen(r) * 5);
char *r3;
#ifdef DEBUG
fprintf(stderr, "fixbounds(): Start string = \"%s\"\n", r);
#endif
for (i = 0; i < strlen(r); i++) {
if (r[i] != '\0' && r[i] == '\\' && (r[i + 1] == '>' || r[i + 1] == '<')) {
strcpy(&r2[j], "[[:");
@ -194,12 +190,11 @@ const char *fixbounds(const char *r)
r2[j] = r[i];
j++;
}
r2[j] = '\0';
r3 = mallocstrcpy(NULL, r2);
free(r2);
#ifdef DEBUG
fprintf(stderr, "fixbounds(): Ending string = \"%s\"\n", r3);
#endif
return (const char *) r3;
#endif /* !GNU_WORDBOUNDS */

View File

@ -1440,11 +1440,6 @@ long get_unicode_kbinput(WINDOW *win, int kbinput)
statusline(HUSH, _("Unicode Input: %s"), partial);
}
#ifdef DEBUG
fprintf(stderr, "get_unicode_kbinput(): kbinput = %d, uni_digits = %d, uni = %ld, retval = %ld\n",
kbinput, uni_digits, uni, retval);
#endif
/* If we have an end result, reset the Unicode digit counter. */
if (retval != ERR)
uni_digits = 0;