+++ /dev/null
-dnl Copyright (C) 2013 ProFUSION embedded systems
-dnl This code is public domain and can be freely used or copied.
-
-dnl Macro for checking if va_list is an array
-
-dnl Usage: AC_C_VA_LIST_AS_ARRAY
-dnl call AC_DEFINE for HAVE_VA_LIST_AS_ARRAY if for this architecture
-dnl va_list is defined as an array
-
-AC_DEFUN([AC_C_VA_LIST_AS_ARRAY],
-[
-AC_MSG_CHECKING([whether va_list is defined as an array])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <stdlib.h>
-#include <stdarg.h>
-
-#define BUILD_ASSERT(cond) \
- do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
- ]],
- [[
-va_list ap;
-BUILD_ASSERT(__builtin_types_compatible_p(typeof(ap),
- typeof(&(ap)[0])));
-return 0;
- ]])],
- [have_va_list_as_array="no"],
- [have_va_list_as_array="yes"])
-
-AC_MSG_RESULT([${have_va_list_as_array}])
-
-if test "x${have_va_list_as_array}" = "xyes" ; then
- AC_DEFINE([HAVE_VA_LIST_AS_ARRAY], [1], [Define to 1 if va_list is an array])
-fi
-
-])
-
-dnl End of ac_valist.m4
return _edbus_message_arguments_vget((EDBus_Message *)msg, signature, ap);
}
-EAPI Eina_Bool
-edbus_message_iter_arguments_vappend(EDBus_Message_Iter *iter, const char *signature, va_list ap)
+static Eina_Bool
+_edbus_message_iter_arguments_vappend(EDBus_Message_Iter *iter, const char *signature, va_list *aq)
{
DBusSignatureIter signature_iter;
Eina_Bool r = EINA_TRUE;
while ((type = dbus_signature_iter_get_signature(&signature_iter)))
{
if (type[0] != DBUS_TYPE_VARIANT && !type[1])
- r = append_basic(type[0], MAKE_PTR_FROM_VA_LIST(ap),
- &iter->dbus_iterator);
+ r = append_basic(type[0], aq, &iter->dbus_iterator);
else
{
EDBus_Message_Iter **user_itr;
EDBus_Message_Iter *sub;
- user_itr = va_arg(ap, EDBus_Message_Iter **);
+ user_itr = va_arg(*aq, EDBus_Message_Iter **);
sub = _message_iterator_new(EINA_TRUE);
if (!sub)
{
}
return r;
+
+}
+
+EAPI Eina_Bool
+edbus_message_iter_arguments_vappend(EDBus_Message_Iter *iter, const char *signature, va_list ap)
+{
+ va_list aq;
+ Eina_Bool ret;
+
+ va_copy(aq, ap);
+ ret = _edbus_message_iter_arguments_vappend(iter, signature, &aq);
+ va_end(aq);
+
+ return ret;
}
EAPI Eina_Bool
}
static Eina_Bool
-_edbus_message_arguments_vappend(EDBus_Message *msg, const char *signature, va_list ap)
+_edbus_message_arguments_vappend(EDBus_Message *msg, const char *signature, va_list *aq)
{
DBusSignatureIter signature_iter;
EDBus_Message_Iter *iter;
while ((type = dbus_signature_iter_get_current_type(&signature_iter)))
{
if (dbus_type_is_basic(type))
- r = append_basic(type, MAKE_PTR_FROM_VA_LIST(ap),
- &iter->dbus_iterator);
+ r = append_basic(type, aq, &iter->dbus_iterator);
else
{
ERR("sig = %s | edbus_message_arguments_append() and \
EINA_SAFETY_ON_NULL_RETURN_VAL(signature, EINA_FALSE);
va_start(ap, signature);
- ret = _edbus_message_arguments_vappend(msg, signature, ap);
+ ret = _edbus_message_arguments_vappend(msg, signature, &ap);
va_end(ap);
return ret;
}
EAPI Eina_Bool
edbus_message_arguments_vappend(EDBus_Message *msg, const char *signature, va_list ap)
{
+ va_list aq;
+ Eina_Bool ret;
+
EDBUS_MESSAGE_CHECK_RETVAL(msg, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(signature, EINA_FALSE);
- return _edbus_message_arguments_vappend(msg, signature, ap);
+
+ va_copy(aq, ap);
+ ret = _edbus_message_arguments_vappend(msg, signature, &aq);
+ va_end(aq);
+
+ return ret;
}
EAPI EDBus_Message_Iter *
return EINA_TRUE;
}
-EAPI Eina_Bool
-edbus_message_iter_arguments_get(EDBus_Message_Iter *iter, const char *signature, ...)
-{
- va_list ap;
- Eina_Bool ret;
-
- va_start(ap, signature);
- ret = edbus_message_iter_arguments_vget(iter, signature, ap);
- va_end(ap);
-
- return ret;
-}
-
-EAPI Eina_Bool
-edbus_message_iter_arguments_vget(EDBus_Message_Iter *iter, const char *signature, va_list ap)
+static Eina_Bool
+_edbus_message_iter_arguments_vget(EDBus_Message_Iter *iter, const char *signature, va_list *aq)
{
int iter_type;
DBusSignatureIter sig_iter;
}
if (dbus_type_is_basic(iter_type))
- get_basic(iter_type, &iter->dbus_iterator, MAKE_PTR_FROM_VA_LIST(ap));
+ get_basic(iter_type, &iter->dbus_iterator, aq);
else
{
- EDBus_Message_Iter **user_itr = va_arg(ap, EDBus_Message_Iter **);
+ EDBus_Message_Iter **user_itr = va_arg(*aq, EDBus_Message_Iter **);
EDBus_Message_Iter *sub_itr;
sub_itr = _message_iterator_new(EINA_FALSE);
}
return dbus_signature_iter_get_current_type(&sig_iter) == DBUS_TYPE_INVALID;
+
+}
+
+EAPI Eina_Bool
+edbus_message_iter_arguments_get(EDBus_Message_Iter *iter, const char *signature, ...)
+{
+ va_list ap;
+ Eina_Bool ret;
+
+ va_start(ap, signature);
+ ret = _edbus_message_iter_arguments_vget(iter, signature, &ap);
+ va_end(ap);
+
+ return ret;
+}
+
+EAPI Eina_Bool
+edbus_message_iter_arguments_vget(EDBus_Message_Iter *iter, const char *signature, va_list ap)
+{
+ va_list aq;
+ Eina_Bool ret;
+
+ va_copy(aq, ap);
+ ret = _edbus_message_iter_arguments_vget(iter, signature, &aq);
+ va_end(aq);
+
+ return ret;
}
EAPI void