xserver janitorial work

Greg KH greg at kroah.com
Wed Jun 7 15:32:43 PDT 2006


I'm starting to go through the xserver tree and cleaning up a variety of
minor "janitorial" type stuff in order to get a bit more familar with
the code base.  I was starting to just clean up the obviously wrong
compiler warnings, and running 'sparse' on the tree when I ran into some
code that has old, K&R style function declarations.

An example of this would be:
	Bool
	mfbRealizeFont( pscr, pFont)
	    ScreenPtr   pscr;
	    FontPtr     pFont;
	{
	    return (TRUE);
	}

Tools like 'sparse' choke hard on this kind of C code, so does anyone
object to me cleaning functions like this up to be "proper" C code?
This example would then look like:
	Bool
	mfbRealizeFont(ScreenPtr pscr, FontPtr pFont)
	{
	    return (TRUE);
	}


Also, I see a lot of places where #ifdefs are used within .c files and
even within functions that can easily be fixed with proper header
definitions to keep the .c code clean and provide no extra code
generated.

A (made up) example of that would be something like:

#ifdef FOO_FEATURE
static void foo_feature(int baz)
{
	do_something_interesting(baz);
}
#endif

....

void big_foo(int bar)
{
	....
#ifdef FOO_FEATURE
	if (some_test_is_true()) {
		foo_feature(bar);
	}
#endif
	.....
}

That can be rewritten to be:

#ifdef FOO_FEATURE
void foo_feature(int baz)
{
	do_something_interesting(baz);
}
#else
static inline foo_feature(int baz) { }
#endif

....

void big_foo(int bar)
{
	....
	if (some_test_is_true()) {
		foo_feature(bar);
	}
	.....
}


Any objections to these kinds of cleanups?

thanks,

greg k-h



More information about the xorg mailing list