[ZODB-Dev] BTreeModuleTemplate.c inflexibility

Martijn Faassen faassen@vet.uu.nl
Fri, 28 Feb 2003 16:33:20 +0100


Tim Peters wrote:
> [Martijn Faassen]
[snip deluded interpretation by Martijn and correction]

Aah, right. The joys of the C preprocessor and my fuzzy head. :)

[snip]
> I assume there's at least one typo there, and possibly several:
> MOD_NAME_PREFIX is currently defined in 5 different files (one for each
> existing flavor of BTree), and you can't go unconditionally stomping on it.

You're right, I wasn't thinking there at all. I hope this is better:

#ifndef EXTERNAL_MODULE_NAME
#define EXTERNAL_MODULE_NAME "zodb.btrees."
#endif

#define MODULE_NAME EXTERNAL_MODULE_NAME MOD_NAME_PREFIX "BTree."

> I have no objection to this, provided that:
> 
> a) It doesn't break what's already there.
> 
> b) You document the intended use of MODULE_NAME in Maintainer.txt.
>    It's not documented now because it's effectively an unalterable
>    constant now.  But if you switch it to a parameterizable thing,
>    then without docs the intent is a mystery and so will certainly
>    either break, or just get deleted again, later (I routinely delete
>    decoys in the BTree code, whenever I figure out that some
>    preprocessor obscurity is unused).

What about what's proposed above? If there are no objections (or a better
name for EXTERNAL_MODULE_NAME) I'll go ahead with checking that in and 
I'll add a note to Maintainer.txt as well.

Regards,

Martijn