[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev lynx2.8.5dev.16i.patch.gz
From: |
Mike Castle |
Subject: |
Re: lynx-dev lynx2.8.5dev.16i.patch.gz |
Date: |
Tue, 13 Jan 2004 20:31:14 -0800 |
In article <address@hidden>,
Thomas Dickey <address@hidden> wrote:
>#ifdef EXP_NESTED_TABLES
> if (nested_tables) {
> enclosing = Stbl_get_enclosing(me->stbl);
> me->last_anchor_before_stbl = Stbl_get_last_anchor_before(me->stbl);
> if (enclosing == NULL) {
> Stbl_free(me->stbl);
> free_enclosed_stbl(me);
> } else {
> if (me->enclosed_stbl == NULL)
> me->enclosed_stbl = HTList_new();
> HTList_addObject(me->enclosed_stbl, me->stbl);
> CTRACE((tfp, "endStblTABLE: postpone free %p\n", me->stbl));
> }
> me->stbl = enclosing;
> } else {
> Stbl_free(me->stbl);
> me->stbl = NULL;
> } <<---- 4890
>#else
> Stbl_free(me->stbl);
> me->stbl = NULL;
>#endif
Wow! Is that ugly!
It took me a good number of years to get away from cuddling braces, but
this is one example of why to put braces on a line by themselves.
I would have written this as:
#ifdef EXP_NESTED_TABLES
if (nested_tables)
{
enclosing = Stbl_get_enclosing(me->stbl);
me->last_anchor_before_stbl = Stbl_get_last_anchor_before(me->stbl);
if (enclosing == NULL) {
Stbl_free(me->stbl);
free_enclosed_stbl(me);
} else {
if (me->enclosed_stbl == NULL)
me->enclosed_stbl = HTList_new();
HTList_addObject(me->enclosed_stbl, me->stbl);
CTRACE((tfp, "endStblTABLE: postpone free %p\n", me->stbl));
}
me->stbl = enclosing;
}
else
#endif
{
Stbl_free(me->stbl);
me->stbl = NULL;
}
Still 22 lines, but at least eliminated the duplicated code, and no #else.
At least that code wasn't like:
} else {
#else
{
#endif
Stbl_free(me->stbl);
me->stbl = NULL;
#ifdef EXP_NESTED_TABLES
}
#endif
mrc
--
Mike Castle address@hidden www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
Re: lynx-dev lynx2.8.5dev.16i.patch.gz, Thomas Dickey, 2004/01/05