Re: [GD-DEVEL] proper usage of entities.h

[email protected] (Mike Frysinger)
Newsgroups php.gd.devel
Organization wh0rd.org
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 827 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.2 (GNU/Linux)

iQIVAwUARdB/iUFjO5/oN/WBAQLnpw/8DE83kBR+DK6JoBhs1D8e2FpbbTUqxbXB
RNTH5dCCE4ErG3JSJMHRY9G9iyDl4MxYJfXwxUP35Ik2x0XvJMTDCsDTjHnllMYQ
73Nkb/XyaYLcJEGovZUDQP7retpEi8zijxRYzDumh0lY3Vx/mXQq6wgE5S/gsW3e
zzySI7+kGgSdMdEhII3vIGqklUP+A2cTe8cSdxsfVF7BhNRwC67Lq9Dgd3ZNIFgq
Iqw/KcXVgZUYB7MayzF6hqw1S4YS8PmVTRIDcptBq8+WugxqoPlhyb4rKX7C1HGG
dIi3nIjRtSXkIKhY0MGyPq5rUQHpQD7WBRi8UezMpIUNmWAEIKh28vOhj2DugKpX
zyUQbwjSNsa5cxjlnoaWm3aF2sTjI37wkG8DtB8qG6sYR0YQghb/ORrtcSBqmWQm
5RJEi4kLeph5PTkAu2xxN4OJWQEkkBIWGjYURexCTHSl832LhFs087Dwa7hMTLbI
ZzeeLsTAJkZbA2HzxdDNxpWI3iwZeF4WXBfsI3x6CL+GBJIHs26umctPFYVm/QO8
rev5oc3W67kPkBN9m/bYYUkYM3ypab3xuNFGTy0ZWkzFuC1de4Q+h21dQafQ5KfJ
OkQX5mQOKl1BZN/j7LnHlimWJrahEGBQEWT5x3zGtcfN4Y/rNGvQQlNBXtgMks3K
UVNFQJlnv1Q=
=n1qU
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.