cURL / Mailing Lists / curl-library / Single Mail

curl-library

stricter source code style compliance

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 27 Apr 2011 10:05:12 +0200 (CEST)

Hi friends,

Our 'lib' directory is right now exactly 100 C source files and 102 H headers.
Time to clean up and make the code easier to read and find your way around in.

I have just pushed code to git that cleans up lots of previous inconsistencies
in code style and guideline strictness.

This work of mine introduces a perl script called lib/checksrc.pl, which
checks source code for curl code style compliance and clearly and loudly warns
when deviances are found. I'm currently having it always run just after "make
all" when ./configure --enable-debug has been used to build the makefiles, as
this will greatly help us catch non-conformant patches earlier but I figure we
should also provide a convenient phony make target for regular builds.

The script is by no means very advanced and it doesn't catch a lot of
different mistakes, but I've used it to detect some of the current problems
that I then could hunt down and edit. I'm sure we can enhance and polish this
script a lot over time.

I wouldn't mind having the script itself able to correct the flaws, but that
was a bit too much work for me.

I started this effort trying to get GNU indent to clean up the code for me,
but I didn't manage to force it to output the code the way I want so I gave up
that line of work.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-27