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

Re: Intent to package: vcg



Previously Philipp Frauenfelder wrote:
> True. Here is an excerpt of this ugly code (I'm sending as is,
> no line breakin):

Looks like code to remove nodes from a double-linked list. The uglifying
seems quite simple to fix though, using a vi-macro and indent I got it
readble in a couple of seconds. Here you go:

{
	GNODE h,*hp;
	assert((node));
	if ((( node )->next) )
		(( (( node )->next) )->before)  = (( node )->before) ;
	else
		nodelistend = (( node )->before)  ;
	if ((( node )->before) )
		(( (( node )->before) )->next) = (( node )->next) ;
	else
		nodelist = (( node )->next) ;
	h = gs_ide44 ;
	hp = &gs_ide44 ;
	while (h) { 
		if ((( h )->refnum) >=(( node )->refnum) )
			break;
		hp = &((( h )->next) );
		h = (( h )->next) ;
	}
	*hp = node;
	if (h)
		(( +node )->before) = (( h )->before) ;
	else
		(( node )->before) = gs_ide45 ;
	(( node )->next) = h;
	if (h)
		(( h )->before) = node;
	else 
		gs_ide45 = node;
}

Wichert (geez, I must be bored :)

-- 
==============================================================================
This combination of bytes forms a message written to you by Wichert Akkerman.
E-Mail: wakkerma@cs.leidenuniv.nl
WWW: http://www.wi.leidenuniv.nl/~wichert/

Attachment: pgpffVbEctjzE.pgp
Description: PGP signature


Reply to: