From: ceriel Date: Mon, 9 Feb 1998 09:49:00 +0000 (+0000) Subject: Replaced a couple of UnGetChar calls with ChPushBack calls. The X-Git-Tag: release-5-5~15 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=91cb060d10a9a93ce8fe2f287f8d2cd8733e191a;p=ack.git Replaced a couple of UnGetChar calls with ChPushBack calls. The UnGetChar call is wrong after skipspaces(). --- diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 61364ca7e..f2ac213aa 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -388,7 +388,7 @@ do_define() /* read the replacement text if there is any */ ch = skipspaces(ch,0); /* find first character of the text */ ASSERT(ch != EOI); - /* UngetChar() is not right when replacement starts with a '/' */ + /* UnGetChar() is not right when replacement starts with a '/' */ ChPushBack(ch); repl_text = get_text((nformals > 0) ? formals : 0, &length); macro_def(id, repl_text, nformals, length, NOFLAG); diff --git a/lang/cem/cemcom.ansi/replace.c b/lang/cem/cemcom.ansi/replace.c index b5983c7df..b5571db27 100644 --- a/lang/cem/cemcom.ansi/replace.c +++ b/lang/cem/cemcom.ansi/replace.c @@ -150,7 +150,7 @@ expand_macro(repl, idf) ch = GetChar(); ch = skipspaces(ch,1); if (ch != '(') { /* no replacement if no () */ - UnGetChar(); + ChPushBack(ch); return 0; } else getactuals(repl, idf); @@ -194,17 +194,17 @@ expand_defined(repl) if ((class(ch) != STIDF) && (class(ch) != STELL)) { error("identifier missing"); if (parens && ch != ')') error(") missing"); - if (!parens || ch != ')') UnGetChar(); + if (!parens || ch != ')') ChPushBack(ch); add2repl(repl, '0'); return; } - UnGetChar(); + ChPushBack(ch); id = GetIdentifier(0); ASSERT(id || class(ch) == STELL); ch = GetChar(); ch = skipspaces(ch, 0); if (parens && ch != ')') error(") missing"); - if (!parens || ch != ')') UnGetChar(); + if (!parens || ch != ')') ChPushBack(ch); add2repl(repl, (id && id->id_macro) ? '1' : '0'); add2repl(repl, ' '); } diff --git a/lang/cem/cpp.ansi/domacro.c b/lang/cem/cpp.ansi/domacro.c index 77722a93e..47f09af28 100644 --- a/lang/cem/cpp.ansi/domacro.c +++ b/lang/cem/cpp.ansi/domacro.c @@ -366,7 +366,7 @@ do_define() /* read the replacement text if there is any */ ch = skipspaces(ch,0); /* find first character of the text */ assert(ch != EOI); - /* UngetChar() is not right when replacement starts with a '/' */ + /* UnGetChar() is not right when replacement starts with a '/' */ ChPushBack(ch); repl_text = get_text((nformals > 0) ? formals : 0, &length); macro_def(str2idf(str, 0), repl_text, nformals, length, NOFLAG); diff --git a/lang/cem/cpp.ansi/replace.c b/lang/cem/cpp.ansi/replace.c index d1804a901..5f4b7f77b 100644 --- a/lang/cem/cpp.ansi/replace.c +++ b/lang/cem/cpp.ansi/replace.c @@ -140,7 +140,7 @@ expand_macro(repl, idf) ch = GetChar(); ch = skipspaces(ch,1); if (ch != '(') { /* no replacement if no () */ - UnGetChar(); + ChPushBack(ch); return 0; } else getactuals(repl, idf); @@ -185,11 +185,11 @@ expand_defined(repl) if ((class(ch) != STIDF) && (class(ch) != STELL)) { error("identifier missing"); if (parens && ch != ')') error(") missing"); - if (!parens || ch != ')') UnGetChar(); + if (!parens || ch != ')') ChPushBack(ch); add2repl(repl,'0'); return; } - UnGetChar(); + ChPushBack(ch); str = GetIdentifier(0); if (str) { id = findidf(str); @@ -198,7 +198,7 @@ expand_defined(repl) ch = GetChar(); ch = skipspaces(ch, 0); if (parens && ch != ')') error(") missing"); - if (!parens || ch != ')') UnGetChar(); + if (!parens || ch != ')') ChPushBack(ch); add2repl(repl, (id && id->id_macro) ? '1' : '0'); add2repl(repl, ' '); }