|
From: Daniel J S. <dan...@ie...> - 2006-03-13 17:55:52
|
Juergen Wieferink wrote:
> Am Montag, 13. M=E4rz 2006 08:36 schrieb Daniel J Sebald:
>=20
>>OK, I've made a fix for the palette allocation problem and placed it on=
the
>>SourceForge patch page (1448674). This should make us all happier.
>>
>>For reference, the original email was of Jan 7, 2006. Basically, Petr
>>could apply this at any time, but I left it on the patch page for Hans =
and
>>Ethan to take a run through. I made a complete "copy_at()" in eval.c
>>patterned after "free_at()". Using free_at() as a model should mean no
>>memory is assigned by copy_at() that won't be deleted by free_at(). So=
,
>>take a look at that.
>=20
>=20
> I've curiously taken a look into your copy_at() because IIRC
> free_at() was written by me. :-)
>=20
> I do see a minor problem with your code:
>=20
> eval.c (copy_at):
>=20
> + if ( a->index =3D=3D PUSHC || a->index =3D=3D DOLLARS ) {
> + if ((a->arg.v_arg.type =3D=3D STRING)
> + && a->arg.v_arg.v.string_val
> + && (b->arg.v_arg.v.string_val
> + =3D (char *) gp_alloc(strlen(a->arg.v_arg.v.string_val)+1, "cop=
ied=20
> v_arg")))
> + strcpy(b->arg.v_arg.v.string_val, a->arg.v_arg.v.string_val);
> + else
> + b->arg.v_arg.v.string_val =3D NULL;
> + }
>=20
> If the current action "a" pushes an integer or real value (quite
> common), this code seems to init ...string_val to NULL. But
> "string_val" is the char* member of a *union*, resetting the numeric
> value to be pushed. AFAICS, you should omit the "else" part.
>=20
> I haven't compiled or tested your implementation, and probably it
> won't harm for your specific usage of copy_at().
You are right. It is a union, which I knew, but I just wasn't thinking s=
traight. I will fix that and update the patch.
Thanks Juergen,
Dan
|