lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev lynx2.8.5dev.12d.patch.gz


From: Leonid Pauzner
Subject: Re: lynx-dev lynx2.8.5dev.12d.patch.gz
Date: Fri, 3 Jan 2003 18:57:20 +0300 (MSK)

2-Jan-2003 19:15 Thomas Dickey wrote:
> On Thu, Jan 02, 2003 at 01:45:32PM +0300, Leonid Pauzner wrote:
>>
>> > There may be another palliative variant using freeHTLine:
>> > we malloc/free the last line each time, but other lines
>> > are allocated in the pool. (To free the last line
>> > we store its pointer in other place). May supply a patch.
>>
>> Here it is, against your '12d' snapshot

> Here's a different approach.

That's OK  (if it works for you).

> --- GridText.c.orig   Wed Jan  1 17:22:48 2003
> +++ GridText.c        Thu Jan  2 18:46:42 2003
> @@ -318,7 +318,7 @@

>  /* last line buffer; the second is used in split_line(). Not in pool! */
>  /* "can't wrap in middle of multibyte sequences, so allocate 2 extra" */
> -static char tmp_long_line[2][LINE_SIZE(MAX_LINE+2)];  /* (HTLine*) in fact*/
> +typedef char HTLineTemp[LINE_SIZE(MAX_LINE+2)];

>  typedef struct _TextAnchor {
>       struct _TextAnchor *    next;
> @@ -352,6 +352,7 @@
>       HTParentAnchor *        node_anchor;

>       HTLine *                last_line;
> +     HTLineTemp              temp_line[2];
>       int                     Lines;          /* Number of them */
>       TextAnchor *            first_anchor;   /* double-linked on demand */
>       TextAnchor *            last_anchor;
> @@ -882,7 +883,7 @@
>      if (!self->pool)
>       outofmem(__FILE__, "HText_New");

> -    line = self->last_line = (HTLine*)tmp_long_line[0];
> +    line = self->last_line = (HTLine*)self->temp_line[0];
>      line->next = line->prev = line;
>      line->offset = line->size = 0;
>      line->data[line->size] = '\0';
> @@ -2516,7 +2517,14 @@
>           added_chars = newpos[ip] - oldpos[ip];
>      if (line->size + added_chars > MAX_LINE - 2)
>       return NULL;
> -    POOLallocHTLine(mod_line, line->size + added_chars);
> +    if (line == text->last_line) {
> +     if (line == (HTLine*)text->temp_line[0])
> +        mod_line = (HTLine*)text->temp_line[1];
> +     else
> +        mod_line = (HTLine*)text->temp_line[0];
> +    } else {
> +     POOLallocHTLine(mod_line, line->size + added_chars);
> +    }
>      if (!mod_line)
>       return NULL;
>      if (!prev_anchor)
> @@ -2644,7 +2652,10 @@
>      /*
>       *  Set new line.
>       */
> -    POOLallocHTLine(line, MAX_LINE);
> +    if (previous == (HTLine*)text->temp_line[0])
> +     line = (HTLine*)text->temp_line[1];
> +    else
> +     line = (HTLine*)text->temp_line[0];
>      if (line == NULL)
>       return;
>      memset(line, 0, LINE_SIZE(0));



> --
> Thomas E. Dickey <address@hidden>
> http://invisible-island.net
> ftp://invisible-island.net

> ; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden



; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]