Re: [GD-DEVEL] proper usage of entities.h
| From: | Mike Frysinger | Date: | Mon, 12 Feb 2007 14:54:01 +0000 |
| Subject: | Re: [GD-DEVEL] proper usage of entities.h | ||
| References: | 1 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-97@lists.php.net to get a copy of this message | ||
On Monday 12 February 2007, Mike Frysinger wrote:
> the entities.h header seems kind of an odd duck for exportation to users of
> GD ... if you have a project that includes it, then every object file will
> get its own copy of the large structure which can cause some problems
>
> since the contents of the entities array/structure shouldnt be assumed to
> be static (eg you can assume index 0 is always AElig), is there a good
> reason for exporting the definition ?
>
> shouldnt the header simply read like:
> ...
> extern struct entities_s {
> char *name;
> int value;
> } entities;
> ...
also, the way it's written will cause all sorts of ABI troubles ... if newer
versions of gd increase ENTITY_NAME_LENGTH_MAX or NR_OF_ENTITIES, then any
program that is compiled against the newer gd but run against an older gd
will segfault
better to remove both defines and require people to assume NUL terminated
strings and to insert a NULL marker into the definition of the structure:
..
{"zwnj", 8204},
{NULL,-1}
};
yes, this should only really happen when the spec changes (which will probably
be never), but the ABI is still handled incorrectly ...
-mike
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]