From 01dd85983fe112e30ce681774e1dc10b64bd7680 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Sat, 8 Jan 2000 07:34:40 +0100 Subject: [PATCH] Fixed the at_* functions to report the position in the top level feed. Rev: src/modules/Parser/html.c:1.61 --- src/modules/Parser/html.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/modules/Parser/html.c b/src/modules/Parser/html.c index 7f8fbdaab3..04f3f50912 100644 --- a/src/modules/Parser/html.c +++ b/src/modules/Parser/html.c @@ -2914,6 +2914,8 @@ static void low_feed(struct pike_string *ps) { struct piece *f; + if (!ps->len) return; + f=malloc(sizeof(struct piece)); if (!f) error("feed: out of memory\n"); @@ -3182,20 +3184,26 @@ void html_write_out(INT32 args) static void html_at_line(INT32 args) { + struct feed_stack *st = THIS->stack; pop_n_elems(args); - push_int(THIS->stack->pos.lineno); + while (st->prev) st = st->prev; + push_int(st->pos.lineno); } static void html_at_char(INT32 args) { + struct feed_stack *st = THIS->stack; pop_n_elems(args); - push_int(THIS->stack->pos.byteno); + while (st->prev) st = st->prev; + push_int(st->pos.byteno); } static void html_at_column(INT32 args) { + struct feed_stack *st = THIS->stack; pop_n_elems(args); - push_int(THIS->stack->pos.byteno-THIS->stack->pos.linestart); + while (st->prev) st = st->prev; + push_int(st->pos.byteno-st->pos.linestart); } static void html_at(INT32 args) -- GitLab