BUGFIX reflect default argument promotions in va_* function
char and short variadic arguments automatically promotes to int. This
must be reflected in va_arg() and the int type is supposed to be used
as type to obtain instead of the original type.
Furthermore, the last non-variadic argument cannot be regiter variable,
function, array or automatically promoted type.
In same case, we are using enum type as the last non-variadic and variadic
arguments and above restrictins were not reflected. Even that the
enum is represented as int on common architectures / by common compilers,
the restrictions should be reflected.
Fixes #12
diff --git a/src/io.c b/src/io.c
index 979e84b..ca238e3 100644
--- a/src/io.c
+++ b/src/io.c
@@ -958,7 +958,7 @@
/* return -1 can change session status */
int
-nc_write_msg(struct nc_session *session, NC_MSG_TYPE type, ...)
+nc_write_msg(struct nc_session *session, int type, ...)
{
va_list ap;
int count;
@@ -986,6 +986,7 @@
arg.session = session;
arg.len = 0;
+
switch (type) {
case NC_MSG_RPC:
content = va_arg(ap, struct lyd_node *);