[comp.databases] A BUG in C DATABASE

ron@vaxnix.tandy.COM (Ron Light) (12/14/88)

The macro "ENT_SIZE" is incorrectly formulated.  The problem will exhibit
itself if you port this database to a cpu that insists on words beginning on
an even boundary.  The size produced by the macro can be either odd or even
depending on the length of the key.  If it happens to be odd, it will not
work (and on a 680xx cause a buss error) on those machines.  Following is
the corrected macro:


#define ENT_SIZE(pe)  (((strlen((pe)->key) + 1 + 2 * sizeof(RECPOS))+1)&~1)


	Ron Light
	...{killer,texbell}!vaxnix!ron