Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115748810
D28725.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
988 B
Referenced Files
None
Subscribers
None
D28725.diff
View Options
diff --git a/sys/ddb/db_lex.c b/sys/ddb/db_lex.c
--- a/sys/ddb/db_lex.c
+++ b/sys/ddb/db_lex.c
@@ -97,18 +97,12 @@
db_endlp = db_line;
}
-static int db_look_char = 0;
-
static int
db_read_char(void)
{
int c;
- if (db_look_char != 0) {
- c = db_look_char;
- db_look_char = 0;
- }
- else if (db_lp >= db_endlp)
+ if (db_lp >= db_endlp)
c = -1;
else
c = *db_lp++;
@@ -116,10 +110,22 @@
}
static void
-db_unread_char(c)
- int c;
+db_unread_char(int c)
{
- db_look_char = c;
+
+ if (c == -1) {
+ /* Unread EOL at EOL is okay. */
+ if (db_lp < db_endlp)
+ db_error("db_unread_char(-1) before end of line\n");
+ } else {
+ if (db_lp > db_line) {
+ db_lp--;
+ if (*db_lp != c)
+ db_error("db_unread_char() wrong char\n");
+ } else {
+ db_error("db_unread_char() at beginning of line\n");
+ }
+ }
}
static int db_look_token = 0;
@@ -155,7 +161,6 @@
db_flush_lex(void)
{
db_flush_line();
- db_look_char = 0;
db_look_token = 0;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 29, 2:25 AM (9 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17836062
Default Alt Text
D28725.diff (988 B)
Attached To
Mode
D28725: ddb: just move cursor when the lexer backs up
Attached
Detach File
Event Timeline
Log In to Comment