From 179851e1e1d30d7decb76a78025b5ac7d47640b6 Mon Sep 17 00:00:00 2001 From: Marc Horowitz Date: Thu, 7 May 1992 18:37:55 +0000 Subject: WM_DELETE_WINDOW support and unlink_gram support --- zwgc/xrevstack.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'zwgc/xrevstack.c') diff --git a/zwgc/xrevstack.c b/zwgc/xrevstack.c index e21d6a1..ae22da7 100644 --- a/zwgc/xrevstack.c +++ b/zwgc/xrevstack.c @@ -23,6 +23,7 @@ static char rcsid_xrevstack_c[] = "$Id$"; #include x_gram *bottom_gram = NULL; +x_gram *unlinked = NULL; int reverse_stack = 0; void add_to_bottom(gram) @@ -60,11 +61,40 @@ void delete_gram(gram) } else { bottom_gram = NULL; } + } else if (gram == unlinked) { + if (gram->above) { + unlinked = gram->above; + unlinked->below = NULL; + } else { + unlinked = NULL; + } } else { if (gram->above) gram->above->below = gram->below; gram->below->above = gram->above; } + + /* fix up above & below pointers so that calling delete_gram + again is safe */ + gram->below = gram; + gram->above = gram; +} + +void unlink_gram(gram) + x_gram *gram; +{ + delete_gram(gram); + + if (unlinked) { + unlinked->below = gram; + gram->below = NULL; + gram->above = unlinked; + unlinked = gram; + } else { + gram->above = NULL; + gram->below = NULL; + unlinked = gram; + } } #endif -- cgit v1.2.3