[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev lynx2.8.5dev.12d.patch.gz
From: |
Thomas Dickey |
Subject: |
Re: lynx-dev lynx2.8.5dev.12d.patch.gz |
Date: |
Thu, 2 Jan 2003 19:15:11 -0500 |
User-agent: |
Mutt/1.3.27i |
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.
--- 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
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, (continued)
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Thomas E. Dickey, 2003/01/01
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Leonid Pauzner, 2003/01/02
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Leonid Pauzner, 2003/01/02
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Thomas Dickey, 2003/01/02
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Leonid Pauzner, 2003/01/03
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Thomas Dickey, 2003/01/03
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Leonid Pauzner, 2003/01/03
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Leonid Pauzner, 2003/01/07
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Thomas Dickey, 2003/01/07
- Message not available
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Leonid Pauzner, 2003/01/10
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz,
Thomas Dickey <=
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Leonid Pauzner, 2003/01/03
- Re: lynx-dev lynx2.8.5dev.12d.patch.gz, Thomas Dickey, 2003/01/03