nmh-workers
[Top] [All Lists]

Renaming config/config.c.

2021-05-16 08:43:41
Hi,

config/config.c has a lot of globals variables defined in it.
http://git.savannah.nongnu.org/cgit/nmh.git/tree/config/config.c

That, version.sh, and the version.c it produces are the only things in
the config directory.

There's no config/config.h which matches with a list of externs thus
users of the global variables either hope it's in those spread about in
h/mh.h or write their own, e.g.

    uip/mhparam.c:extern char *mhdocdir;

Adding a config/config.h would be confusing as config.h is also the name
produced by ./configure, as is conventional.

    configure.ac:AC_CONFIG_HEADER([config.h])

I think it would be nicer if there was a matching *.{c,h} pair defining
and declaring the globals and it would continue my whittling down of
externs in the *.c files.  Which should change name?

I'd suggest config/config.c becomes globals.c and a globals.h added.
They could sit in the config directory or, given they're a key interface
of the subroutines, move to the existing sbr directory.

We could even consider cutting down on the duplication by having
globals.h use macros which give declarations most of the time but
definitions when included by globals.c.

Thoughts, +1s, ‘from my cold, dead hands’, etc., welcome.

-- 
Cheers, Ralph.

<Prev in Thread] Current Thread [Next in Thread>