[Swan-dev] true or TRUE?

D. Hugh Redelmeier hugh at mimosa.com
Sun Apr 22 16:18:26 UTC 2018


| From: Andrew Cagney <andrew.cagney at gmail.com>

| I see 91f7de765cefc33bd8685b6d69d31db64462e4c5 replaced #include
| <stdbool.h> with an include of linux/include/libreswan.h ,  When
| compared to the contents of "libreswan.h", what the neighbour's dog
| thew up in the front yard looks neat and tidy.    The only real
| purpose of that file is to keep linix centri code shared between pluto
| and klips (kernel) happy, new non-kernel code really doesn't need to
| be including it.
|
| Now we could of course try to extract TRUE and FALSE from
| "libreswan.h" and, say, create a new standalone libreswan centric
| header ("lswbool.h"?).  But lets be honest, to what end?  We've
| already got <stdbool.h>, and its been around for going on 18 years
| now, so lets use it.

Our current header system is a mess of several conventions and
non-conventions mingled.  That's something I would like fixed.

The intention has been and is that there be a baseline header for
libreswan code.  Among other things, this baseline should itself
include all the no-brainer headers so that each individual .c file
does not need a large collection of includes that don't actually
inform a human reader.

(We actually have several kinds of code, and the baseline header for
each kind might be different.  That's an important separate
discussion.)

There is no useful information to the reader in an #incude <stdbool.h>
in each source file.  It's just so pervasive.  The baseline header
should #include all headers of that kind.

It's a matter of taste, but I would exclude <stdio.h> from the
baseline.  It is interesting to know whether a .c file uses stdio.

Back to your point.

If libreswan.h is not the correct baseline header, we should change
that #include appropriately.

If libreswan.h is a dog's former breakfast, we should fix it as much
as possible.  If we cannot fix it, we should minimize it's use.

Where we include <stdbool.h> we can (and do) define TRUE and FALSE.
That's twice, I think.  Better if it were once.


More information about the Swan-dev mailing list