Merge branch 'tizen_base' into tizen
[platform/upstream/libxml2.git] / trio.c
diff --git a/trio.c b/trio.c
index b116ccc..c8b9c84 100644 (file)
--- a/trio.c
+++ b/trio.c
@@ -99,7 +99,7 @@
 #endif
 #include <stddef.h>
 
-#ifdef HAVE_ERRNO_H
+#if defined( HAVE_ERRNO_H ) || defined( __VMS )
 #include <errno.h>
 #endif
 
 # define TRIO_ERROR_RETURN(x,y) (-1)
 #endif
 
+#ifndef VA_LIST_IS_ARRAY
+#define TRIO_VA_LIST_PTR       va_list *
+#define TRIO_VA_LIST_ADDR(l)   (&(l))
+#define TRIO_VA_LIST_DEREF(l)  (*(l))
+#else
+#define TRIO_VA_LIST_PTR       va_list
+#define TRIO_VA_LIST_ADDR(l)   (l)
+#define TRIO_VA_LIST_DEREF(l)  (l)
+#endif
+
 typedef unsigned long trio_flags_t;
 
 
 /*************************************************************************
  * Platform specific definitions
  */
-#if defined(TRIO_PLATFORM_UNIX)
+#if defined(TRIO_PLATFORM_UNIX) || defined(TRIO_PLATFORM_OS400)
 # include <unistd.h>
 # include <signal.h>
 # include <locale.h>
@@ -208,7 +218,7 @@ typedef unsigned long int trio_ulonglong_t;
 #endif
 
 /* Maximal and fixed integer types */
-#if defined(TRIO_COMPILER_SUPPORTS_C99)
+#if defined(TRIO_COMPILER_SUPPORTS_C99) && !defined( __VMS )
 # include <stdint.h>
 typedef intmax_t trio_intmax_t;
 typedef uintmax_t trio_uintmax_t;
@@ -216,8 +226,12 @@ typedef int8_t trio_int8_t;
 typedef int16_t trio_int16_t;
 typedef int32_t trio_int32_t;
 typedef int64_t trio_int64_t;
-#elif defined(TRIO_COMPILER_SUPPORTS_UNIX98)
+#elif defined(TRIO_COMPILER_SUPPORTS_UNIX98) || defined( __VMS )
 # include <inttypes.h>
+#ifdef __VMS
+typedef long long int          intmax_t;
+typedef unsigned long long int uintmax_t;
+#endif
 typedef intmax_t trio_intmax_t;
 typedef uintmax_t trio_uintmax_t;
 typedef int8_t trio_int8_t;
@@ -307,6 +321,12 @@ typedef trio_longlong_t trio_int64_t;
 #define NAN_LOWER "nan"
 #define NAN_UPPER "NAN"
 
+#if !defined(HAVE_ISASCII) && !defined(isascii)
+#ifndef __VMS
+# define isascii(x) ((unsigned int)(x) < 128)
+#endif
+#endif
+
 /* Various constants */
 enum {
   TYPE_PRINT = 1,
@@ -376,7 +396,7 @@ enum {
   /* Maximal string lengths for user-defined specifiers */
   MAX_USER_NAME = 64,
   MAX_USER_DATA = 256,
-  
+
   /* Maximal length of locale separator strings */
   MAX_LOCALE_SEPARATOR_LENGTH = MB_LEN_MAX,
   /* Maximal number of integers in grouping */
@@ -1020,23 +1040,23 @@ TRIO_ARGS2((name, prev),
           trio_userdef_t **prev)
 {
   trio_userdef_t *def;
-  
+
   if (internalEnterCriticalRegion)
     (void)internalEnterCriticalRegion(NULL);
-  
+
   for (def = internalUserDef; def; def = def->next)
     {
       /* Case-sensitive string comparison */
       if (trio_equal_case(def->name, name))
        break;
-      
+
       if (prev)
        *prev = def;
     }
-  
+
   if (internalLeaveCriticalRegion)
     (void)internalLeaveCriticalRegion(NULL);
-  
+
   return def;
 }
 #endif
@@ -1163,7 +1183,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
           int type,
           TRIO_CONST char *format,
           trio_parameter_t *parameters,
-          va_list *arglist,
+          TRIO_VA_LIST_PTR arglist,
           trio_pointer_t *argarray)
 {
   /* Count the number of times a parameter is referenced */
@@ -1200,7 +1220,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
 
   /* One and only one of arglist and argarray must be used */
   assert((arglist != NULL) ^ (argarray != NULL));
-  
+
   /*
    * The 'parameters' array is not initialized, but we need to
    * know which entries we have used.
@@ -1213,7 +1233,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
 #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
   (void)mblen(NULL, 0);
 #endif
-  
+
   while (format[index])
     {
 #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
@@ -1291,7 +1311,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
                      /* Skip if no precision */
                      if (QUALIFIER_DOT == format[index])
                        break;
-                     
+
                      /* After the first dot we have the precision */
                      flags |= FLAGS_PRECISION;
                      if ((QUALIFIER_STAR == format[index])
@@ -1336,7 +1356,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
                  else if (dots == 1) /* Base */
                    {
                      dots++;
-                     
+
                      /* After the second dot we have the base */
                      flags |= FLAGS_BASE;
                      if ((QUALIFIER_STAR == format[index])
@@ -1535,7 +1555,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
                    }
                  else
                    return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
-                 
+
                  flags |= FLAGS_FIXED_SIZE;
                  break;
 #endif
@@ -1563,7 +1583,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
                  gotSticky = TRUE;
                  break;
 #endif
-                 
+
 #if defined(QUALIFIER_VARSIZE)
                case QUALIFIER_VARSIZE:
                  flags |= FLAGS_VARSIZE_PARAMETER;
@@ -1628,9 +1648,9 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
              indices[varsize] = pos;
              varsize = pos++;
            }
-         
+
          indices[currentParam] = pos;
-         
+
          switch (format[index++])
            {
 #if defined(SPECIFIER_CHAR_UPPER)
@@ -1689,11 +1709,11 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
                    }
                }
              break;
-             
+
            case SPECIFIER_INTEGER:
              parameters[pos].type = FORMAT_INT;
              break;
-             
+
            case SPECIFIER_UNSIGNED:
              flags |= FLAGS_UNSIGNED;
              parameters[pos].type = FORMAT_INT;
@@ -1793,11 +1813,11 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
              {
                unsigned int max;
                int without_namespace = TRUE;
-               
+
                parameters[pos].type = FORMAT_USER_DEFINED;
                parameters[pos].user_name[0] = NIL;
                tmpformat = (char *)&format[index];
-             
+
                while ((ch = format[index]))
                  {
                    index++;
@@ -1845,7 +1865,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
              }
              break;
 #endif /* defined(SPECIFIER_USER_DEFINED_BEGIN) */
-             
+
            default:
              /* Bail out completely to make the error more obvious */
               return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
@@ -1853,7 +1873,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
 
          /*  Count the number of times this entry has been used */
          usedEntries[currentParam] += 1;
-         
+
          /* Find last sticky parameters */
          if (gotSticky && !(flags & FLAGS_STICKY))
            {
@@ -1876,7 +1896,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
                    }
                }
            }
-         
+
          parameters[pos].indexAfterSpecifier = index;
          parameters[pos].flags = flags;
          parameters[pos].width = width;
@@ -1884,12 +1904,12 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
          parameters[pos].base = (base == NO_BASE) ? BASE_DECIMAL : base;
          parameters[pos].varsize = varsize;
          pos++;
-         
+
          if (! positional)
            parameterPosition++;
-         
+
        } /* if identifier */
-      
+
     } /* while format characters left */
 
   for (num = 0; num <= maxParam; num++)
@@ -1901,7 +1921,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
          else /* double references detected */
            return TRIO_ERROR_RETURN(TRIO_EDBLREF, num);
        }
-      
+
       i = indices[num];
 
       /*
@@ -1941,14 +1961,14 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
          if (flags & FLAGS_WIDECHAR)
            {
              parameters[i].data.wstring = (argarray == NULL)
-               ? va_arg(*arglist, trio_wchar_t *)
+               ? va_arg(TRIO_VA_LIST_DEREF(arglist), trio_wchar_t *)
                : (trio_wchar_t *)(argarray[num]);
            }
          else
 #endif
            {
              parameters[i].data.string = (argarray == NULL)
-               ? va_arg(*arglist, char *)
+               ? va_arg(TRIO_VA_LIST_DEREF(arglist), char *)
                : (char *)(argarray[num]);
            }
          break;
@@ -1960,7 +1980,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
        case FORMAT_COUNT:
        case FORMAT_UNKNOWN:
          parameters[i].data.pointer = (argarray == NULL)
-           ? va_arg(*arglist, trio_pointer_t )
+           ? va_arg(TRIO_VA_LIST_DEREF(arglist), trio_pointer_t )
            : argarray[num];
          break;
 
@@ -1969,8 +1989,8 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
          if (TYPE_SCAN == type)
            {
               if (argarray == NULL)
-                parameters[i].data.pointer = 
-                  (trio_pointer_t)va_arg(*arglist, trio_pointer_t);
+                parameters[i].data.pointer =
+                  (trio_pointer_t)va_arg(TRIO_VA_LIST_DEREF(arglist), trio_pointer_t);
               else
                 {
                   if (parameters[i].type == FORMAT_CHAR)
@@ -2009,7 +2029,7 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
                      varsize = parameters[i].varsize;
                    }
                  parameters[i].flags &= ~FLAGS_ALL_VARSIZES;
-                 
+
                  if (varsize <= (int)sizeof(int))
                    ;
                  else if (varsize <= (int)sizeof(long))
@@ -2028,36 +2048,36 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
 #if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER)
              if (parameters[i].flags & FLAGS_SIZE_T)
                parameters[i].data.number.as_unsigned = (argarray == NULL)
-                 ? (trio_uintmax_t)va_arg(*arglist, size_t)
+                 ? (trio_uintmax_t)va_arg(TRIO_VA_LIST_DEREF(arglist), size_t)
                  : (trio_uintmax_t)(*((size_t *)argarray[num]));
              else
 #endif
 #if defined(QUALIFIER_PTRDIFF_T)
              if (parameters[i].flags & FLAGS_PTRDIFF_T)
                parameters[i].data.number.as_unsigned = (argarray == NULL)
-                 ? (trio_uintmax_t)va_arg(*arglist, ptrdiff_t)
+                 ? (trio_uintmax_t)va_arg(TRIO_VA_LIST_DEREF(arglist), ptrdiff_t)
                  : (trio_uintmax_t)(*((ptrdiff_t *)argarray[num]));
              else
 #endif
 #if defined(QUALIFIER_INTMAX_T)
              if (parameters[i].flags & FLAGS_INTMAX_T)
                parameters[i].data.number.as_unsigned = (argarray == NULL)
-                 ? (trio_uintmax_t)va_arg(*arglist, trio_intmax_t)
+                 ? (trio_uintmax_t)va_arg(TRIO_VA_LIST_DEREF(arglist), trio_intmax_t)
                  : (trio_uintmax_t)(*((trio_intmax_t *)argarray[num]));
              else
 #endif
              if (parameters[i].flags & FLAGS_QUAD)
                parameters[i].data.number.as_unsigned = (argarray == NULL)
-                 ? (trio_uintmax_t)va_arg(*arglist, trio_ulonglong_t)
+                 ? (trio_uintmax_t)va_arg(TRIO_VA_LIST_DEREF(arglist), trio_ulonglong_t)
                  : (trio_uintmax_t)(*((trio_ulonglong_t *)argarray[num]));
              else if (parameters[i].flags & FLAGS_LONG)
                parameters[i].data.number.as_unsigned = (argarray == NULL)
-                 ? (trio_uintmax_t)va_arg(*arglist, long)
+                 ? (trio_uintmax_t)va_arg(TRIO_VA_LIST_DEREF(arglist), long)
                  : (trio_uintmax_t)(*((long *)argarray[num]));
              else
                {
                  if (argarray == NULL)
-                   parameters[i].data.number.as_unsigned = (trio_uintmax_t)va_arg(*arglist, int);
+                   parameters[i].data.number.as_unsigned = (trio_uintmax_t)va_arg(TRIO_VA_LIST_DEREF(arglist), int);
                  else
                    {
                      if (parameters[i].type == FORMAT_CHAR)
@@ -2078,11 +2098,11 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
           */
          if (parameters[i].flags & FLAGS_USER_DEFINED)
            parameters[i].data.pointer = (argarray == NULL)
-             ? va_arg(*arglist, trio_pointer_t )
+             ? va_arg(TRIO_VA_LIST_DEREF(arglist), trio_pointer_t )
              : argarray[num];
          else
            parameters[i].data.number.as_unsigned = (argarray == NULL)
-             ? (trio_uintmax_t)va_arg(*arglist, int)
+             ? (trio_uintmax_t)va_arg(TRIO_VA_LIST_DEREF(arglist), int)
              : (trio_uintmax_t)(*((int *)argarray[num]));
          break;
 
@@ -2091,17 +2111,17 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
            {
              if (parameters[i].flags & FLAGS_LONGDOUBLE)
                parameters[i].data.longdoublePointer = (argarray == NULL)
-                 ? va_arg(*arglist, trio_long_double_t *)
+                 ? va_arg(TRIO_VA_LIST_DEREF(arglist), trio_long_double_t *)
                  : (trio_long_double_t *)argarray[num];
              else
                 {
                  if (parameters[i].flags & FLAGS_LONG)
                    parameters[i].data.doublePointer = (argarray == NULL)
-                     ? va_arg(*arglist, double *)
+                     ? va_arg(TRIO_VA_LIST_DEREF(arglist), double *)
                      : (double *)argarray[num];
                  else
                    parameters[i].data.doublePointer = (argarray == NULL)
-                     ? (double *)va_arg(*arglist, float *)
+                     ? (double *)va_arg(TRIO_VA_LIST_DEREF(arglist), float *)
                      : (double *)((float *)argarray[num]);
                 }
            }
@@ -2109,13 +2129,13 @@ TRIO_ARGS5((type, format, parameters, arglist, argarray),
            {
              if (parameters[i].flags & FLAGS_LONGDOUBLE)
                parameters[i].data.longdoubleNumber = (argarray == NULL)
-                 ? va_arg(*arglist, trio_long_double_t)
+                 ? va_arg(TRIO_VA_LIST_DEREF(arglist), trio_long_double_t)
                  : (trio_long_double_t)(*((trio_long_double_t *)argarray[num]));
              else
                {
                  if (argarray == NULL)
                    parameters[i].data.longdoubleNumber =
-                     (trio_long_double_t)va_arg(*arglist, double);
+                     (trio_long_double_t)va_arg(TRIO_VA_LIST_DEREF(arglist), double);
                  else
                    {
                      if (parameters[i].flags & FLAGS_SHORT)
@@ -2213,7 +2233,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
     number &= (unsigned long)-1;
   else
     number &= (unsigned int)-1;
-  
+
   /* Build number */
   pointer = bufferend = &buffer[sizeof(buffer) - 1];
   *pointer-- = NIL;
@@ -2260,7 +2280,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
   count = (! ((flags & FLAGS_LEFTADJUST) || (precision == NO_PRECISION)))
     ? precision
     : 0;
-  
+
   /* Adjust width further */
   if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE))
     width--;
@@ -2495,7 +2515,7 @@ TRIO_ARGS4((self, wch, flags, width),
 
   if (width == NO_WIDTH)
     width = sizeof(buffer);
-  
+
   size = wctomb(buffer, wch);
   if ((size <= 0) || (size > width) || (buffer[0] == NIL))
     return 0;
@@ -2537,13 +2557,13 @@ TRIO_ARGS5((self, wstring, flags, width, precision),
 #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
   (void)mblen(NULL, 0);
 #endif
-  
+
   if (wstring == NULL)
     {
       TrioWriteString(self, NULL, flags, width, precision);
       return;
     }
-  
+
   if (NO_PRECISION == precision)
     {
       length = INT_MAX;
@@ -2638,7 +2658,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
   BOOLEAN_T keepTrailingZeroes;
   BOOLEAN_T keepDecimalPoint;
   trio_long_double_t epsilon;
-  
+
   assert(VALID(self));
   assert(VALID(self->OutStream));
   assert(((base >= MIN_BASE) && (base <= MAX_BASE)) || (base == NO_BASE));
@@ -2653,7 +2673,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
                      : NAN_LOWER,
                      flags, width, precision);
       return;
-      
+
     case TRIO_FP_INFINITE:
       if (isNegative)
        {
@@ -2680,7 +2700,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
       /* Finitude */
       break;
     }
-  
+
   /* Normal numbers */
   if (flags & FLAGS_LONGDOUBLE)
     {
@@ -2728,13 +2748,13 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
          precision = FLT_DIG;
        }
     }
-  
+
   if (isNegative)
     number = -number;
 
   if (isHex)
     flags |= FLAGS_FLOAT_E;
-  
+
   if (flags & FLAGS_FLOAT_G)
     {
       if (precision == 0)
@@ -2787,7 +2807,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
 
   integerNumber = floorl(number);
   fractionNumber = number - integerNumber;
-  
+
   /*
    * Truncated number.
    *
@@ -2802,7 +2822,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
     : zeroes + precision;
 
   dblFractionBase = TrioPower(base, fractionDigits);
-  
+
   workNumber = number + 0.5 / dblFractionBase;
   if (floorl(number) != floorl(workNumber))
     {
@@ -2855,7 +2875,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
       integerThreshold = INT_MAX;
       fractionThreshold = INT_MAX;
     }
-  
+
   /*
    * Calculate expected width.
    *  sign + integer part + thousands separators + decimal point
@@ -2891,7 +2911,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
       ((requireTwoDigitExponent ? sizeof("E+0") : sizeof("E+")) - 1);
   if (isHex)
     expectedWidth += sizeof("0X") - 1;
-  
+
   /* Output prefixing */
   if (flags & FLAGS_NILPADDING)
     {
@@ -2937,7 +2957,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
          self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x');
        }
     }
-  
+
   /* Output the integer part and thousand separators */
   dblIntegerBase = 1.0 / TrioPower(base, integerDigits - 1);
   for (i = 0; i < integerDigits; i++)
@@ -2953,7 +2973,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
          self->OutStream(self, digits[(int)fmodl(workNumber, dblBase)]);
        }
       dblIntegerBase *= dblBase;
-      
+
       if (((flags & (FLAGS_FLOAT_E | FLAGS_QUOTE)) == FLAGS_QUOTE)
          && TrioFollowedBySeparator(integerDigits - i))
        {
@@ -2965,7 +2985,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
            }
        }
     }
-  
+
   /* Insert decimal point and build the fraction part */
   trailingZeroes = 0;
 
@@ -3014,7 +3034,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
            }
        }
     }
-  
+
   if (keepTrailingZeroes)
     {
       while (trailingZeroes > 0)
@@ -3023,7 +3043,7 @@ TRIO_ARGS6((self, number, flags, width, precision, base),
          trailingZeroes--;
        }
     }
-  
+
   /* Output exponent */
   if (exponentDigits > 0)
     {
@@ -3080,13 +3100,13 @@ TRIO_ARGS3((data, format, parameters),
   int precision;
   int base;
   int index;
-  
+
   index = 0;
   i = 0;
 #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
   (void)mblen(NULL, 0);
 #endif
-  
+
   while (format[index])
     {
 #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
@@ -3120,7 +3140,7 @@ TRIO_ARGS3((data, format, parameters),
              /* Skip the parameter entries */
              while (parameters[i].type == FORMAT_PARAMETER)
                i++;
-             
+
              flags = parameters[i].flags;
 
              /* Find width */
@@ -3140,7 +3160,7 @@ TRIO_ARGS3((data, format, parameters),
                      width = -width;
                    }
                }
-             
+
              /* Find precision */
              if (flags & FLAGS_PRECISION)
                {
@@ -3171,7 +3191,7 @@ TRIO_ARGS3((data, format, parameters),
                  /* Get base from parameter list */
                  base = (int)parameters[base].data.number.as_signed;
                }
-             
+
              switch (parameters[i].type)
                {
                case FORMAT_CHAR:
@@ -3251,7 +3271,7 @@ TRIO_ARGS3((data, format, parameters),
                case FORMAT_POINTER:
                  {
                    trio_reference_t reference;
-                   
+
                    reference.data = data;
                    reference.parameter = &parameters[i];
                    trio_print_pointer(&reference, parameters[i].data.pointer);
@@ -3354,7 +3374,7 @@ TRIO_ARGS3((data, format, parameters),
                  }
                  break;
 #endif /* defined(FORMAT_USER_DEFINED) */
-                 
+
                default:
                  break;
                } /* switch parameter type */
@@ -3380,7 +3400,7 @@ TrioFormatRef
 TRIO_ARGS4((reference, format, arglist, argarray),
           trio_reference_t *reference,
           TRIO_CONST char *format,
-          va_list *arglist,
+          TRIO_VA_LIST_PTR arglist,
           trio_pointer_t *argarray)
 {
   int status;
@@ -3408,7 +3428,7 @@ TRIO_ARGS6((destination, destinationSize, OutStream, format, arglist, argarray),
           size_t destinationSize,
           void (*OutStream) TRIO_PROTO((trio_class_t *, int)),
           TRIO_CONST char *format,
-          va_list *arglist,
+          TRIO_VA_LIST_PTR arglist,
           trio_pointer_t *argarray)
 {
   int status;
@@ -3564,7 +3584,7 @@ TRIO_ARGS2((self, output),
 
   assert(VALID(self));
   assert(VALID(self->location));
-  
+
   buffer = (char **)self->location;
 
   if (self->processed < self->max)
@@ -3632,9 +3652,9 @@ TRIO_VARGS2((format, va_alist),
   va_list args;
 
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
-  status = TrioFormat(stdout, 0, TrioOutStreamFile, format, &args, NULL);
+  status = TrioFormat(stdout, 0, TrioOutStreamFile, format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -3654,7 +3674,7 @@ TRIO_ARGS2((format, args),
 {
   assert(VALID(format));
 
-  return TrioFormat(stdout, 0, TrioOutStreamFile, format, &args, NULL);
+  return TrioFormat(stdout, 0, TrioOutStreamFile, format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 /**
@@ -3699,9 +3719,9 @@ TRIO_VARGS3((file, format, va_alist),
 
   assert(VALID(file));
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
-  status = TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL);
+  status = TrioFormat(file, 0, TrioOutStreamFile, format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -3723,8 +3743,8 @@ TRIO_ARGS3((file, format, args),
 {
   assert(VALID(file));
   assert(VALID(format));
-  
-  return TrioFormat(file, 0, TrioOutStreamFile, format, &args, NULL);
+
+  return TrioFormat(file, 0, TrioOutStreamFile, format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 /**
@@ -3744,7 +3764,7 @@ TRIO_ARGS3((file, format, args),
 {
   assert(VALID(file));
   assert(VALID(format));
-  
+
   return TrioFormat(file, 0, TrioOutStreamFile, format, NULL, args);
 }
 
@@ -3771,9 +3791,9 @@ TRIO_VARGS3((fd, format, va_alist),
   va_list args;
 
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
-  status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL);
+  status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -3794,8 +3814,8 @@ TRIO_ARGS3((fd, format, args),
           va_list args)
 {
   assert(VALID(format));
-  
-  return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, &args, NULL);
+
+  return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 /**
@@ -3814,7 +3834,7 @@ TRIO_ARGS3((fd, format, args),
           trio_pointer_t *args)
 {
   assert(VALID(format));
-  
+
   return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, NULL, args);
 }
 
@@ -3839,7 +3859,7 @@ TRIO_VARGS4((stream, closure, format, va_alist),
   TRIO_VA_START(args, format);
   data.stream.out = stream;
   data.closure = closure;
-  status = TrioFormat(&data, 0, TrioOutStreamCustom, format, &args, NULL);
+  status = TrioFormat(&data, 0, TrioOutStreamCustom, format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -3859,7 +3879,7 @@ TRIO_ARGS4((stream, closure, format, args),
 
   data.stream.out = stream;
   data.closure = closure;
-  return TrioFormat(&data, 0, TrioOutStreamCustom, format, &args, NULL);
+  return TrioFormat(&data, 0, TrioOutStreamCustom, format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 TRIO_PUBLIC int
@@ -3904,9 +3924,9 @@ TRIO_VARGS3((buffer, format, va_alist),
 
   assert(VALID(buffer));
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
-  status = TrioFormat(&buffer, 0, TrioOutStreamString, format, &args, NULL);
+  status = TrioFormat(&buffer, 0, TrioOutStreamString, format, TRIO_VA_LIST_ADDR(args), NULL);
   *buffer = NIL; /* Terminate with NIL character */
   TRIO_VA_END(args);
   return status;
@@ -3932,7 +3952,7 @@ TRIO_ARGS3((buffer, format, args),
   assert(VALID(buffer));
   assert(VALID(format));
 
-  status = TrioFormat(&buffer, 0, TrioOutStreamString, format, &args, NULL);
+  status = TrioFormat(&buffer, 0, TrioOutStreamString, format, TRIO_VA_LIST_ADDR(args), NULL);
   *buffer = NIL;
   return status;
 }
@@ -3991,7 +4011,7 @@ TRIO_VARGS4((buffer, max, format, va_alist),
 
   TRIO_VA_START(args, format);
   status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
-                     TrioOutStreamStringMax, format, &args, NULL);
+                     TrioOutStreamStringMax, format, TRIO_VA_LIST_ADDR(args), NULL);
   if (max > 0)
     *buffer = NIL;
   TRIO_VA_END(args);
@@ -4021,7 +4041,7 @@ TRIO_ARGS4((buffer, max, format, args),
   assert(VALID(format));
 
   status = TrioFormat(&buffer, max > 0 ? max - 1 : 0,
-                     TrioOutStreamStringMax, format, &args, NULL);
+                     TrioOutStreamStringMax, format, TRIO_VA_LIST_ADDR(args), NULL);
   if (max > 0)
     *buffer = NIL;
   return status;
@@ -4082,7 +4102,7 @@ TRIO_VARGS4((buffer, max, format, va_alist),
   buffer = &buffer[buf_len];
 
   status = TrioFormat(&buffer, max - 1 - buf_len,
-                     TrioOutStreamStringMax, format, &args, NULL);
+                     TrioOutStreamStringMax, format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   *buffer = NIL;
   return status;
@@ -4098,14 +4118,14 @@ TRIO_ARGS4((buffer, max, format, args),
 {
   int status;
   size_t buf_len;
-  
+
   assert(VALID(buffer));
   assert(VALID(format));
 
   buf_len = trio_length(buffer);
   buffer = &buffer[buf_len];
   status = TrioFormat(&buffer, max - 1 - buf_len,
-                     TrioOutStreamStringMax, format, &args, NULL);
+                     TrioOutStreamStringMax, format, TRIO_VA_LIST_ADDR(args), NULL);
   *buffer = NIL;
   return status;
 }
@@ -4126,13 +4146,13 @@ TRIO_VARGS2((format, va_alist),
   char *result = NULL;
 
   assert(VALID(format));
-  
+
   info = trio_xstring_duplicate("");
   if (info)
     {
       TRIO_VA_START(args, format);
       (void)TrioFormat(info, 0, TrioOutStreamStringDynamic,
-                      format, &args, NULL);
+                      format, TRIO_VA_LIST_ADDR(args), NULL);
       TRIO_VA_END(args);
 
       trio_string_terminate(info);
@@ -4151,14 +4171,14 @@ TRIO_ARGS2((format, args),
 {
   trio_string_t *info;
   char *result = NULL;
-  
+
   assert(VALID(format));
-  
+
   info = trio_xstring_duplicate("");
   if (info)
     {
       (void)TrioFormat(info, 0, TrioOutStreamStringDynamic,
-                      format, &args, NULL);
+                      format, TRIO_VA_LIST_ADDR(args), NULL);
       trio_string_terminate(info);
       result = trio_string_extract(info);
       trio_string_destroy(info);
@@ -4180,7 +4200,7 @@ TRIO_VARGS3((result, format, va_alist),
   assert(VALID(format));
 
   *result = NULL;
-  
+
   info = trio_xstring_duplicate("");
   if (info == NULL)
     {
@@ -4190,7 +4210,7 @@ TRIO_VARGS3((result, format, va_alist),
     {
       TRIO_VA_START(args, format);
       status = TrioFormat(info, 0, TrioOutStreamStringDynamic,
-                         format, &args, NULL);
+                         format, TRIO_VA_LIST_ADDR(args), NULL);
       TRIO_VA_END(args);
       if (status >= 0)
        {
@@ -4211,11 +4231,11 @@ TRIO_ARGS3((result, format, args),
 {
   int status;
   trio_string_t *info;
-  
+
   assert(VALID(format));
 
   *result = NULL;
-  
+
   info = trio_xstring_duplicate("");
   if (info == NULL)
     {
@@ -4224,7 +4244,7 @@ TRIO_ARGS3((result, format, args),
   else
     {
       status = TrioFormat(info, 0, TrioOutStreamStringDynamic,
-                         format, &args, NULL);
+                         format, TRIO_VA_LIST_ADDR(args), NULL);
       if (status >= 0)
        {
          trio_string_terminate(info);
@@ -4264,7 +4284,7 @@ TRIO_ARGS3((result, format, args),
    @param name
    @return Handle.
  */
-TRIO_PUBLIC trio_pointer_t 
+TRIO_PUBLIC trio_pointer_t
 trio_register
 TRIO_ARGS2((callback, name),
           trio_callback_t callback,
@@ -4291,23 +4311,23 @@ TRIO_ARGS2((callback, name),
            }
          return NULL;
        }
-      
+
       /* Bail out if namespace is too long */
       if (trio_length(name) >= MAX_USER_NAME)
        return NULL;
-      
+
       /* Bail out if namespace already is registered */
       def = TrioFindNamespace(name, &prev);
       if (def)
        return NULL;
     }
-  
+
   def = (trio_userdef_t *)TRIO_MALLOC(sizeof(trio_userdef_t));
   if (def)
     {
       if (internalEnterCriticalRegion)
        (void)internalEnterCriticalRegion(NULL);
-      
+
       if (name)
        {
          /* Link into internal list */
@@ -4352,12 +4372,12 @@ TRIO_ARGS1((handle),
        {
          if (internalEnterCriticalRegion)
            (void)internalEnterCriticalRegion(NULL);
-         
+
          if (prev == NULL)
            internalUserDef = NULL;
          else
            prev->next = def->next;
-         
+
          if (internalLeaveCriticalRegion)
            (void)internalLeaveCriticalRegion(NULL);
        }
@@ -4377,14 +4397,14 @@ TRIO_ARGS1((ref),
 #if defined(FORMAT_USER_DEFINED)
   assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED);
 #endif
-  
+
   return (((trio_reference_t *)ref)->parameter->user_data);
 }
 
 /*************************************************************************
  * trio_get_argument [public]
  */
-trio_pointer_t 
+trio_pointer_t
 trio_get_argument
 TRIO_ARGS1((ref),
           trio_pointer_t ref)
@@ -4392,7 +4412,7 @@ TRIO_ARGS1((ref),
 #if defined(FORMAT_USER_DEFINED)
   assert(((trio_reference_t *)ref)->parameter->type == FORMAT_USER_DEFINED);
 #endif
-  
+
   return ((trio_reference_t *)ref)->parameter->data.pointer;
 }
 
@@ -4924,9 +4944,9 @@ TRIO_VARGS3((ref, format, va_alist),
   va_list arglist;
 
   assert(VALID(format));
-  
+
   TRIO_VA_START(arglist, format);
-  status = TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL);
+  status = TrioFormatRef((trio_reference_t *)ref, format, TRIO_VA_LIST_ADDR(arglist), NULL);
   TRIO_VA_END(arglist);
   return status;
 }
@@ -4942,8 +4962,8 @@ TRIO_ARGS3((ref, format, arglist),
           va_list arglist)
 {
   assert(VALID(format));
-  
-  return TrioFormatRef((trio_reference_t *)ref, format, &arglist, NULL);
+
+  return TrioFormatRef((trio_reference_t *)ref, format, TRIO_VA_LIST_ADDR(arglist), NULL);
 }
 
 /*************************************************************************
@@ -4957,7 +4977,7 @@ TRIO_ARGS3((ref, format, argarray),
           trio_pointer_t *argarray)
 {
   assert(VALID(format));
-  
+
   return TrioFormatRef((trio_reference_t *)ref, format, NULL, argarray);
 }
 
@@ -5206,7 +5226,7 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, characterclass),
       switch (ch)
        {
        case QUALIFIER_MINUS: /* Scanlist ranges */
-         
+
          /*
           * Both C99 and UNIX98 describes ranges as implementation-
           * defined.
@@ -5233,17 +5253,17 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, characterclass),
            return TRIO_ERROR_RETURN(TRIO_EINVAL, index);
          if (range_begin > range_end)
            return TRIO_ERROR_RETURN(TRIO_ERANGE, index);
-           
+
          for (i = (int)range_begin; i <= (int)range_end; i++)
            characterclass[i]++;
-           
+
          ch = range_end;
          break;
-         
+
 #if TRIO_EXTENSION
 
        case SPECIFIER_GROUP:
-         
+
          switch (format[index + 1])
            {
            case QUALIFIER_DOT: /* Collating symbol */
@@ -5262,15 +5282,15 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, characterclass),
                }
              if (format[++i] != SPECIFIER_UNGROUP)
                return -1;
-             
+
              index = i;
              break;
-         
+
            case QUALIFIER_EQUAL: /* Equivalence class expressions */
              {
                unsigned int j;
                unsigned int k;
-           
+
                if (internalCollationUnconverted)
                  {
                    /* Lazy evaluation of collation array */
@@ -5294,13 +5314,13 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, characterclass),
                  }
                if (format[++i] != SPECIFIER_UNGROUP)
                  return -1;
-               
+
                index = i;
              }
              break;
-         
+
            case QUALIFIER_COLON: /* Character class expressions */
-         
+
              if (trio_equal_max(CLASS_ALNUM, sizeof(CLASS_ALNUM) - 1,
                                 &format[index]))
                {
@@ -5400,9 +5420,9 @@ TRIO_ARGS4((format, indexPointer, flagsPointer, characterclass),
              break;
            }
          break;
-         
+
 #endif /* TRIO_EXTENSION */
-         
+
        default:
          characterclass[(int)ch]++;
          break;
@@ -5448,9 +5468,9 @@ TRIO_ARGS5((self, target, flags, width, base),
        }
       internalDigitsUnconverted = FALSE;
     }
-  
+
   TrioSkipWhitespaces(self);
-  
+
   if (!(flags & FLAGS_UNSIGNED))
     {
       /* Leading sign */
@@ -5464,9 +5484,9 @@ TRIO_ARGS5((self, target, flags, width, base),
          isNegative = TRUE;
        }
     }
-  
+
   count = self->processed;
-  
+
   if (flags & FLAGS_ALTERNATIVE)
     {
       switch (base)
@@ -5527,7 +5547,7 @@ TRIO_ARGS5((self, target, flags, width, base),
        }
       else
        break;
-            
+
       number *= base;
       number += digit;
       gotNumber = TRUE; /* we need at least one digit */
@@ -5538,7 +5558,7 @@ TRIO_ARGS5((self, target, flags, width, base),
   /* Was anything read at all? */
   if (!gotNumber)
     return FALSE;
-  
+
   if (target)
     *target = (isNegative) ? -((trio_intmax_t)number) : number;
   return TRUE;
@@ -5558,7 +5578,7 @@ TRIO_ARGS4((self, target, flags, width),
   int i;
   char ch;
   trio_uintmax_t number;
-  
+
   assert(VALID(self));
   assert(VALID(self->InStream));
 
@@ -5603,7 +5623,7 @@ TRIO_ARGS4((self, target, flags, width),
              break;
            }
        }
-      
+
       if (target)
        target[i] = ch;
     }
@@ -5622,12 +5642,12 @@ TRIO_ARGS4((self, target, flags, width),
           int width)
 {
   int i;
-  
+
   assert(VALID(self));
   assert(VALID(self->InStream));
 
   TrioSkipWhitespaces(self);
-    
+
   /*
    * Continue until end of string is reached, a whitespace is encountered,
    * or width is exceeded
@@ -5663,7 +5683,7 @@ TRIO_ARGS4((self, target, flags, width),
   int amount = 0;
   trio_wchar_t wch;
   char buffer[MB_LEN_MAX + 1];
-  
+
   assert(VALID(self));
   assert(VALID(self->InStream));
 
@@ -5720,7 +5740,7 @@ TRIO_ARGS4((self, target, flags, width),
 {
   int i;
   int size;
-  
+
   assert(VALID(self));
   assert(VALID(self->InStream));
 
@@ -5729,7 +5749,7 @@ TRIO_ARGS4((self, target, flags, width),
 #if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE)
   (void)mblen(NULL, 0);
 #endif
-  
+
   /*
    * Continue until end of string is reached, a whitespace is encountered,
    * or width is exceeded
@@ -5767,7 +5787,7 @@ TRIO_ARGS5((self, target, characterclass, flags, width),
 {
   int ch;
   int i;
-  
+
   assert(VALID(self));
   assert(VALID(self->InStream));
 
@@ -5782,7 +5802,7 @@ TRIO_ARGS5((self, target, characterclass, flags, width),
        target[i] = (char)ch;
       self->InStream(self, &ch);
     }
-  
+
   if (target)
     target[i] = NIL;
   return TRUE;
@@ -5811,12 +5831,12 @@ TRIO_ARGS4((self, target, flags, width),
   BOOLEAN_T isHex = FALSE;
 
   doubleString[0] = 0;
-  
+
   if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1))
     width = sizeof(doubleString) - 1;
-  
+
   TrioSkipWhitespaces(self);
-  
+
   /*
    * Read entire double number from stream. trio_to_double requires
    * a string as input, but InStream can be anything, so we have to
@@ -5902,11 +5922,11 @@ TRIO_ARGS4((self, target, flags, width),
          self->InStream(self, &ch);
        }
       break;
-      
+
     default:
       break;
     }
-  
+
   while ((ch != EOF) && (index - start < width))
     {
       /* Integer part */
@@ -5966,7 +5986,7 @@ TRIO_ARGS4((self, target, flags, width),
     return FALSE;
 
   doubleString[index] = 0;
-  
+
   if (flags & FLAGS_LONGDOUBLE)
     {
       *((trio_long_double_t *)target) = trio_to_long_double(doubleString, NULL);
@@ -5992,7 +6012,7 @@ TRIO_ARGS3((self, target, flags),
   char buffer[sizeof(internalNullString)];
 
   flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | FLAGS_NILPADDING);
-  
+
   if (TrioReadNumber(self,
                     &number,
                     flags,
@@ -6013,7 +6033,7 @@ TRIO_ARGS3((self, target, flags),
                          : buffer,
                          0,
                          sizeof(internalNullString) - 1))
-    {  
+    {
       if (trio_equal_case(buffer, internalNullString))
        {
          if (target)
@@ -6077,12 +6097,12 @@ TRIO_ARGS3((data, format, parameters),
            }
        }
 #endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */
-      
+
       if ((EOF == ch) && (parameters[i].type != FORMAT_COUNT))
        {
          return (assignment > 0) ? assignment : EOF;
        }
-      
+
       if (CHAR_IDENTIFIER == format[index])
        {
          if (CHAR_IDENTIFIER == format[index + 1])
@@ -6101,7 +6121,7 @@ TRIO_ARGS3((data, format, parameters),
          /* Skip the parameter entries */
          while (parameters[i].type == FORMAT_PARAMETER)
            i++;
-         
+
          flags = parameters[i].flags;
          /* Find width */
          width = parameters[i].width;
@@ -6117,7 +6137,7 @@ TRIO_ARGS3((data, format, parameters),
              /* Get base from parameter list */
              base = (int)parameters[base].data.number.as_signed;
            }
-         
+
          switch (parameters[i].type)
            {
            case FORMAT_INT:
@@ -6165,7 +6185,7 @@ TRIO_ARGS3((data, format, parameters),
                  }
              }
              break; /* FORMAT_INT */
-             
+
            case FORMAT_STRING:
 #if TRIO_WIDECHAR
              if (flags & FLAGS_WIDECHAR)
@@ -6229,7 +6249,7 @@ TRIO_ARGS3((data, format, parameters),
                  }
                /* Skip over group specifier */
                index++;
-               
+
                memset(characterclass, 0, sizeof(characterclass));
                rc = TrioGetCharacterClass(format,
                                           &index,
@@ -6291,7 +6311,7 @@ TRIO_ARGS3((data, format, parameters),
                    }
                }
              break; /* FORMAT_COUNT */
-             
+
            case FORMAT_CHAR:
 #if TRIO_WIDECHAR
              if (flags & FLAGS_WIDECHAR)
@@ -6353,7 +6373,7 @@ TRIO_ARGS3((data, format, parameters),
            }
          else
            return assignment;
-         
+
          index++;
        }
     }
@@ -6370,7 +6390,7 @@ TRIO_ARGS6((source, sourceSize, InStream, format, arglist, argarray),
           size_t sourceSize,
           void (*InStream) TRIO_PROTO((trio_class_t *, int *)),
           TRIO_CONST char *format,
-          va_list *arglist,
+          TRIO_VA_LIST_PTR arglist,
           trio_pointer_t *argarray)
 {
   int status;
@@ -6392,7 +6412,7 @@ TRIO_ARGS6((source, sourceSize, InStream, format, arglist, argarray),
       TrioSetLocale();
     }
 #endif
-  
+
   status = TrioParse(TYPE_SCAN, format, parameters, arglist, argarray);
   if (status < 0)
     return status;
@@ -6414,11 +6434,14 @@ TRIO_ARGS2((self, intPointer),
           trio_class_t *self,
           int *intPointer)
 {
-  FILE *file = (FILE *)self->location;
+  FILE *file;
 
   assert(VALID(self));
+  assert(VALID(self->location));
   assert(VALID(file));
 
+  file = (FILE *)self->location;
+
   self->current = fgetc(file);
   if (self->current == EOF)
     {
@@ -6431,7 +6454,7 @@ TRIO_ARGS2((self, intPointer),
       self->processed++;
       self->committed++;
     }
-  
+
   if (VALID(intPointer))
     {
       *intPointer = self->current;
@@ -6447,11 +6470,14 @@ TRIO_ARGS2((self, intPointer),
           trio_class_t *self,
           int *intPointer)
 {
-  int fd = *((int *)self->location);
+  int fd;
   int size;
   unsigned char input;
 
   assert(VALID(self));
+  assert(VALID(self->location));
+
+  fd = *((int *)self->location);
 
   size = read(fd, &input, sizeof(char));
   if (size == -1)
@@ -6468,7 +6494,7 @@ TRIO_ARGS2((self, intPointer),
       self->committed++;
       self->processed++;
     }
-  
+
   if (VALID(intPointer))
     {
       *intPointer = self->current;
@@ -6485,7 +6511,7 @@ TRIO_ARGS2((self, intPointer),
           int *intPointer)
 {
   trio_custom_t *data;
-  
+
   assert(VALID(self));
   assert(VALID(self->location));
 
@@ -6494,7 +6520,7 @@ TRIO_ARGS2((self, intPointer),
   self->current = (data->stream.in == NULL)
     ? NIL
     : (data->stream.in)(data->closure);
-  
+
   if (self->current == NIL)
     {
       self->current = EOF;
@@ -6504,7 +6530,7 @@ TRIO_ARGS2((self, intPointer),
       self->processed++;
       self->committed++;
     }
-  
+
   if (VALID(intPointer))
     {
       *intPointer = self->current;
@@ -6537,7 +6563,7 @@ TRIO_ARGS2((self, intPointer),
       self->processed++;
       self->committed++;
     }
-  
+
   if (VALID(intPointer))
     {
       *intPointer = self->current;
@@ -6578,11 +6604,11 @@ TRIO_VARGS2((format, va_alist),
   va_list args;
 
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
   status = TrioScan((trio_pointer_t)stdin, 0,
                    TrioInStreamFile,
-                   format, &args, NULL);
+                   format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -6594,10 +6620,10 @@ TRIO_ARGS2((format, args),
           va_list args)
 {
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)stdin, 0,
                  TrioInStreamFile,
-                 format, &args, NULL);
+                 format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 TRIO_PUBLIC int
@@ -6607,7 +6633,7 @@ TRIO_ARGS2((format, args),
           trio_pointer_t *args)
 {
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)stdin, 0,
                  TrioInStreamFile,
                  format, NULL, args);
@@ -6628,11 +6654,11 @@ TRIO_VARGS3((file, format, va_alist),
 
   assert(VALID(file));
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
   status = TrioScan((trio_pointer_t)file, 0,
                    TrioInStreamFile,
-                   format, &args, NULL);
+                   format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -6646,10 +6672,10 @@ TRIO_ARGS3((file, format, args),
 {
   assert(VALID(file));
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)file, 0,
                  TrioInStreamFile,
-                 format, &args, NULL);
+                 format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 TRIO_PUBLIC int
@@ -6661,7 +6687,7 @@ TRIO_ARGS3((file, format, args),
 {
   assert(VALID(file));
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)file, 0,
                  TrioInStreamFile,
                  format, NULL, args);
@@ -6681,11 +6707,11 @@ TRIO_VARGS3((fd, format, va_alist),
   va_list args;
 
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
   status = TrioScan((trio_pointer_t)&fd, 0,
                    TrioInStreamFileDescriptor,
-                   format, &args, NULL);
+                   format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -6698,10 +6724,10 @@ TRIO_ARGS3((fd, format, args),
           va_list args)
 {
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)&fd, 0,
                  TrioInStreamFileDescriptor,
-                 format, &args, NULL);
+                 format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 TRIO_PUBLIC int
@@ -6712,7 +6738,7 @@ TRIO_ARGS3((fd, format, args),
           trio_pointer_t *args)
 {
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)&fd, 0,
                  TrioInStreamFileDescriptor,
                  format, NULL, args);
@@ -6735,11 +6761,11 @@ TRIO_VARGS4((stream, closure, format, va_alist),
 
   assert(VALID(stream));
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
   data.stream.in = stream;
   data.closure = closure;
-  status = TrioScan(&data, 0, TrioInStreamCustom, format, &args, NULL);
+  status = TrioScan(&data, 0, TrioInStreamCustom, format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -6753,13 +6779,13 @@ TRIO_ARGS4((stream, closure, format, args),
           va_list args)
 {
   trio_custom_t data;
-  
+
   assert(VALID(stream));
   assert(VALID(format));
 
   data.stream.in = stream;
   data.closure = closure;
-  return TrioScan(&data, 0, TrioInStreamCustom, format, &args, NULL);
+  return TrioScan(&data, 0, TrioInStreamCustom, format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 TRIO_PUBLIC int
@@ -6771,7 +6797,7 @@ TRIO_ARGS4((stream, closure, format, args),
           trio_pointer_t *args)
 {
   trio_custom_t data;
-  
+
   assert(VALID(stream));
   assert(VALID(format));
 
@@ -6795,11 +6821,11 @@ TRIO_VARGS3((buffer, format, va_alist),
 
   assert(VALID(buffer));
   assert(VALID(format));
-  
+
   TRIO_VA_START(args, format);
   status = TrioScan((trio_pointer_t)&buffer, 0,
                    TrioInStreamString,
-                   format, &args, NULL);
+                   format, TRIO_VA_LIST_ADDR(args), NULL);
   TRIO_VA_END(args);
   return status;
 }
@@ -6813,10 +6839,10 @@ TRIO_ARGS3((buffer, format, args),
 {
   assert(VALID(buffer));
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)&buffer, 0,
                  TrioInStreamString,
-                 format, &args, NULL);
+                 format, TRIO_VA_LIST_ADDR(args), NULL);
 }
 
 TRIO_PUBLIC int
@@ -6828,7 +6854,7 @@ TRIO_ARGS3((buffer, format, args),
 {
   assert(VALID(buffer));
   assert(VALID(format));
-  
+
   return TrioScan((trio_pointer_t)&buffer, 0,
                  TrioInStreamString,
                  format, NULL, args);