From 4823150780322f5698e38116a01340eaf876146a Mon Sep 17 00:00:00 2001 From: Michael Schmitt Date: Sun, 1 Apr 2007 14:44:10 +0000 Subject: [PATCH] remove redundant lyxerr.debugging checks; macro LYXERR already checks whether the output is actually needed git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17680 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/CutAndPaste.C | 7 +++--- src/lyxserver.C | 4 +--- src/output_latex.C | 9 ++++---- src/trans.C | 57 +++++++++++++++++++--------------------------- 4 files changed, 32 insertions(+), 45 deletions(-) diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index e554ac6311..00831851f0 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -664,10 +664,9 @@ void copySelection(LCursor & cur, docstring const & plaintext) void saveSelection(LCursor & cur) { - if (lyxerr.debugging(Debug::ACTION)) - lyxerr << BOOST_CURRENT_FUNCTION << ": `" - << to_utf8(cur.selectionAsString(true)) << "'." - << endl; + LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `" + << to_utf8(cur.selectionAsString(true)) << "'." + << endl; if (cur.selection()) copySelectionToStack(cur, selectionBuffer); diff --git a/src/lyxserver.C b/src/lyxserver.C index f009e5a9e0..bcf9a321c5 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -300,9 +300,7 @@ void LyXComm::send(string const & msg) return; } - if (lyxerr.debugging(Debug::LYXSERVER)) { - lyxerr << "LyXComm: Sending '" << msg << '\'' << endl; - } + LYXERR(Debug::LYXSERVER) << "LyXComm: Sending '" << msg << '\'' << endl; if (pipename.empty()) return; diff --git a/src/output_latex.C b/src/output_latex.C index bf04ff658e..eaa7391449 100644 --- a/src/output_latex.C +++ b/src/output_latex.C @@ -203,8 +203,8 @@ TeXEnvironment(Buffer const & buf, texrow.newline(); } - if (par != paragraphs.end() && lyxerr.debugging(Debug::LATEX)) - lyxerr << "TeXEnvironment...done " << &*par << endl; + if (par != paragraphs.end()) + LYXERR(Debug::LATEX) << "TeXEnvironment...done " << &*par << endl; return par; } @@ -457,9 +457,8 @@ TeXOnePar(Buffer const & buf, texrow.newline(); } - if (boost::next(pit) != paragraphs.end() && - lyxerr.debugging(Debug::LATEX)) - lyxerr << "TeXOnePar...done " << &*boost::next(pit) << endl; + if (boost::next(pit) != paragraphs.end()) + LYXERR(Debug::LATEX) << "TeXOnePar...done " << &*boost::next(pit) << endl; return ++pit; } diff --git a/src/trans.C b/src/trans.C index 739ab03b7b..9b0433afcb 100644 --- a/src/trans.C +++ b/src/trans.C @@ -134,20 +134,18 @@ int Trans::load(LyXLex & lex) switch (lex.lex()) { case KMOD: { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "KMOD:\t" << lex.getString() << endl; + LYXERR(Debug::KBMAP) << "KMOD:\t" << lex.getString() << endl; + if (lex.next(true)) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "key\t`" << lex.getString() - << '\'' << endl; + LYXERR(Debug::KBMAP) << "key\t`" << lex.getString() + << '\'' << endl; } else return -1; docstring const keys = lex.getDocString(); if (lex.next(true)) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "accent\t`" << lex.getString() + LYXERR(Debug::KBMAP) << "accent\t`" << lex.getString() << '\'' << endl; } else return -1; @@ -162,8 +160,7 @@ int Trans::load(LyXLex & lex) // But we need to fix up all the kmap files first // so that this field is not present anymore. if (lex.next(true)) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "allowed\t`" << lex.getString() + LYXERR(Debug::KBMAP) << "allowed\t`" << lex.getString() << '\'' << endl; } else return -1; @@ -233,22 +230,20 @@ int Trans::load(LyXLex & lex) case KMAP: { unsigned char key_from; - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "KMAP:\t" << lex.getString() << endl; + LYXERR(Debug::KBMAP) << "KMAP:\t" << lex.getString() << endl; + if (lex.next(true)) { key_from = lex.getString()[0]; - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.getString() << '\'' - << endl; + LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\'' + << endl; } else return -1; if (lex.next(true)) { docstring const string_to = lex.getDocString(); keymap_[key_from] = string_to; - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << to_utf8(string_to) << '\'' - << endl; + LYXERR(Debug::KBMAP) << "\t`" << to_utf8(string_to) << '\'' + << endl; } else return -1; @@ -259,28 +254,25 @@ int Trans::load(LyXLex & lex) char_type key; docstring str; - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "KXMOD:\t" << lex.getString() << endl; + LYXERR(Debug::KBMAP) << "KXMOD:\t" << lex.getString() << endl; + if (lex.next(true)) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.getString() << '\'' - << endl; + LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\'' + << endl; accent = getkeymod(lex.getString()); } else return -1; if (lex.next(true)) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.getString() << '\'' - << endl; + LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\'' + << endl; key = lex.getDocString()[0]; } else return -1; if (lex.next(true)) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "\t`" << lex.getString() << '\'' - << endl; + LYXERR(Debug::KBMAP) << "\t`" << lex.getString() << '\'' + << endl; str = lex.getDocString(); } else return -1; @@ -354,11 +346,10 @@ tex_accent getkeymod(string const & p) /* return modifier - decoded from p and update p */ { for (int i = 1; i <= TEX_MAX_ACCENT; ++i) { - if (lyxerr.debugging(Debug::KBMAP)) - lyxerr << "p = " << p - << ", lyx_accent_table[" << i - << "].name = `" << lyx_accent_table[i].name - << '\'' << endl; + LYXERR(Debug::KBMAP) << "p = " << p + << ", lyx_accent_table[" << i + << "].name = `" << lyx_accent_table[i].name + << '\'' << endl; if (lyx_accent_table[i].name && contains(p, lyx_accent_table[i].name)) {