lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev [PATCH 2.8.5-dev15] table cleanup


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.5-dev15] table cleanup
Date: Thu, 17 Jul 2003 07:40:25 -0700
User-agent: Mutt/1.4i

This fixes (a rare) segfault.  The actual reason for this segfault is
that lynx ignores non-breakable space in most situations; the table
logic was not expecting this, thus a branch was entered which should
not have been entered at all.

Until the question with non-breakable spaces is resolved, this fix
hardens the branch in question so that it does not break even if
entered this way.  ;-)

Enjoy,
Ilya

--- ./src/TRSTable.c~   Fri Jun 20 18:57:27 2003
+++ ./src/TRSTable.c    Thu Jul 17 16:39:32 2003
@@ -585,12 +585,17 @@ PRIVATE int Stbl_addCellToRow ARGS9(
        while (me->ncells + colspan + 1 > me->allocated + growby)
            growby += CELLS_GROWBY;
        if (growby) {
-           if (me->allocated == 0 && !me->cells) {
+           if (!me->cells) {
                cells = typecallocn(STable_cellinfo, growby);
            } else {
-               cells = realloc(me->cells,
-                                 (me->allocated + growby)
-                                 * sizeof(STable_cellinfo));
+               if (me->allocated == 0) { /* Put into pool */
+                   cells = typecallocn(STable_cellinfo, growby);
+                   memcpy(cells, me->cells, 
+                          me->ncells * sizeof(STable_cellinfo));
+               } else
+                   cells = realloc(me->cells,
+                                   (me->allocated + growby)
+                                   * sizeof(STable_cellinfo));
                for (i = 0; cells && i < growby; i++) {
                    cells[me->allocated + i].alignment = HT_ALIGN_NONE;
                }

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

reply via email to

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