[patch] varargs use
David Zeuthen
david@fubar.dk
Thu, 26 Feb 2004 08:50:16 +0100
--=-Pbusve0H1Ih5xh9w9k4M
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sat, 2003-12-20 at 21:34, Havoc Pennington wrote:
> On Sat, 2003-12-20 at 13:17, David Zeuthen wrote:
> >
> > It's C99, so probably not that portable. Btw, using va_start/va_end is
> > not possible as the caller gives the va_list, yes?.
> >
>
> Right. I think what we need to do is make our own portable va_copy
> macro, much as glib does.
>
Ok, so I've now finally done this, see attached patch. I took the
configure.in bits from glib to provide us with a DBUS_VA_COPY macro so
we need glib authors permissions to relicense under AFL 2.0 and GPL.
Havoc, do you know who I should get in touch with to get this
permission? (your name is in the AUTHORS file).
Ok to commit?
Thanks,
David
--=-Pbusve0H1Ih5xh9w9k4M
Content-Disposition: attachment; filename=dze_va_copy_macro_and_fix_for_ppc.patch
Content-Transfer-Encoding: base64
Content-Type: text/x-patch; name=dze_va_copy_macro_and_fix_for_ppc.patch; charset=
PyBweXRob24vLmRlcHMNCj8gcHl0aG9uLy5saWJzDQo/IHB5dGhvbi9NYWtlZmlsZQ0KPyBweXRo
b24vTWFrZWZpbGUuaW4NCj8gcHl0aG9uL2RidXNfYmluZGluZ3MuYw0KPyBweXRob24vZGJ1c19i
aW5kaW5ncy5sYQ0KPyBweXRob24vZGJ1c19iaW5kaW5ncy5sbw0KPyBweXRob24vZGJ1c19iaW5k
aW5ncy5weXgNCj8gdGVzdC9nbGliLy5kZXBzDQo/IHRlc3QvZ2xpYi8ubGlicw0KPyB0ZXN0L2ds
aWIvTWFrZWZpbGUNCj8gdGVzdC9nbGliL01ha2VmaWxlLmluDQo/IHRlc3QvZ2xpYi90ZXN0LWRi
dXMtZ2xpYg0KPyB0ZXN0L2dsaWIvdGVzdC1wcm9maWxlDQo/IHRlc3QvZ2xpYi90ZXN0LXNlcnZp
Y2UtZ2xpYg0KPyB0ZXN0L2dsaWIvdGVzdC10aHJlYWQtY2xpZW50DQo/IH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