[svn] GnuPG - r4554 - trunk/common
svn author wk
cvs at cvs.gnupg.org
Wed Aug 1 20:14:00 CEST 2007
Author: wk
Date: 2007-08-01 20:13:31 +0200 (Wed, 01 Aug 2007)
New Revision: 4554
Modified:
trunk/common/ChangeLog
trunk/common/estream-printf.c
Log:
Removed unportable testing code.
Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog 2007-07-29 02:58:26 UTC (rev 4553)
+++ trunk/common/ChangeLog 2007-08-01 18:13:31 UTC (rev 4554)
@@ -1,3 +1,9 @@
+2007-08-01 Werner Koch <wk at g10code.com>
+
+ * estream-printf.c (read_dummy_value): Removed as it is useless now.
+ (read_values): Remove check on !vaargs which is not anymore needed
+ and anyway not portable. Reported by Peter O'Gorman.
+
2007-07-16 Werner Koch <wk at g10code.com>
* estream.c (es_func_file_create): Clear NO_CLOSE flag.
Modified: trunk/common/estream-printf.c
===================================================================
--- trunk/common/estream-printf.c 2007-07-29 02:58:26 UTC (rev 4553)
+++ trunk/common/estream-printf.c 2007-08-01 18:13:31 UTC (rev 4554)
@@ -644,57 +644,7 @@
return -1;
}
-/* This function is used for testing to provide default arguments. */
-static int
-read_dummy_value (value_t *value, valtype_t vt)
-{
- switch (vt)
- {
- case VALTYPE_CHAR: value->a_char = 'a'; break;
- case VALTYPE_CHAR_PTR: value->a_char_ptr = NULL; break;
- case VALTYPE_SCHAR: value->a_schar = 'a'; break;
- case VALTYPE_SCHAR_PTR: value->a_schar_ptr = NULL; break;
- case VALTYPE_UCHAR: value->a_uchar = 'a'; break;
- case VALTYPE_SHORT: value->a_short = -4711; break;
- case VALTYPE_USHORT: value->a_ushort = 4711; break;
- case VALTYPE_SHORT_PTR: value->a_short_ptr = NULL; break;
- case VALTYPE_INT: value->a_int = 42; break;
- case VALTYPE_INT_PTR: value->a_int_ptr = NULL; break;
- case VALTYPE_UINT: value->a_uint = 65535; break;
- case VALTYPE_LONG: value->a_long = 11071961; break;
- case VALTYPE_ULONG: value->a_ulong = 19610711; break;
- case VALTYPE_LONG_PTR: value->a_long_ptr = NULL; break;
-#ifdef HAVE_LONG_LONG_INT
- case VALTYPE_LONGLONG: value->a_longlong = 11223344; break;
- case VALTYPE_ULONGLONG: value->a_ulonglong = 2233445566u; break;
- case VALTYPE_LONGLONG_PTR: value->a_longlong_ptr = NULL; break;
-#endif
- case VALTYPE_DOUBLE: value->a_double = 3.1415926535; break;
-#ifdef HAVE_LONG_DOUBLE
- case VALTYPE_LONGDOUBLE: value->a_longdouble = 2.7; break;
-#endif
- case VALTYPE_STRING: value->a_string = "heart of gold"; break;
- case VALTYPE_POINTER: value->a_void_ptr = (void*)0xdeadbeef; break;
-#ifdef HAVE_INTMAX_T
- case VALTYPE_INTMAX: value->a_intmax = 100; break;
- case VALTYPE_INTMAX_PTR: value->a_intmax_ptr = NULL; break;
-#endif
-#ifdef HAVE_UINTMAX_T
- case VALTYPE_UINTMAX: value->a_uintmax = 200; break;
-#endif
- case VALTYPE_SIZE: value->a_size = 65537; break;
- case VALTYPE_SIZE_PTR: value->a_size_ptr = NULL; break;
-#ifdef HAVE_PTRDIFF_T
- case VALTYPE_PTRDIFF: value->a_ptrdiff = 2; break;
- case VALTYPE_PTRDIFF_PTR: value->a_ptrdiff_ptr = NULL; break;
-#endif
- default: /* Unsupported type. */
- return -1;
- }
- return 0;
-}
-
/* This function reads all the values as specified by VALUETABLE into
VALUETABLE. The values are expected in VAARGS. The function
returns -1 if a specified type is not supported. */
@@ -708,102 +658,94 @@
value_t *value = &valuetable[validx].value;
valtype_t vt = valuetable[validx].vt;
- if (!vaargs)
+ switch (vt)
{
- if (read_dummy_value (value, vt))
- return -1;
- }
- else
- {
- switch (vt)
- {
- case VALTYPE_CHAR: value->a_char = va_arg (vaargs, int); break;
- case VALTYPE_CHAR_PTR:
- value->a_char_ptr = va_arg (vaargs, char *);
- break;
- case VALTYPE_SCHAR: value->a_schar = va_arg (vaargs, int); break;
- case VALTYPE_SCHAR_PTR:
- value->a_schar_ptr = va_arg (vaargs, signed char *);
- break;
- case VALTYPE_UCHAR: value->a_uchar = va_arg (vaargs, int); break;
- case VALTYPE_SHORT: value->a_short = va_arg (vaargs, int); break;
- case VALTYPE_USHORT: value->a_ushort = va_arg (vaargs, int); break;
- case VALTYPE_SHORT_PTR:
- value->a_short_ptr = va_arg (vaargs, short *);
- break;
- case VALTYPE_INT:
- value->a_int = va_arg (vaargs, int);
- break;
- case VALTYPE_INT_PTR:
- value->a_int_ptr = va_arg (vaargs, int *);
- break;
- case VALTYPE_UINT:
- value->a_uint = va_arg (vaargs, unsigned int);
- break;
- case VALTYPE_LONG:
- value->a_long = va_arg (vaargs, long);
- break;
- case VALTYPE_ULONG:
- value->a_ulong = va_arg (vaargs, unsigned long);
- break;
- case VALTYPE_LONG_PTR:
- value->a_long_ptr = va_arg (vaargs, long *);
- break;
+ case VALTYPE_CHAR: value->a_char = va_arg (vaargs, int); break;
+ case VALTYPE_CHAR_PTR:
+ value->a_char_ptr = va_arg (vaargs, char *);
+ break;
+ case VALTYPE_SCHAR: value->a_schar = va_arg (vaargs, int); break;
+ case VALTYPE_SCHAR_PTR:
+ value->a_schar_ptr = va_arg (vaargs, signed char *);
+ break;
+ case VALTYPE_UCHAR: value->a_uchar = va_arg (vaargs, int); break;
+ case VALTYPE_SHORT: value->a_short = va_arg (vaargs, int); break;
+ case VALTYPE_USHORT: value->a_ushort = va_arg (vaargs, int); break;
+ case VALTYPE_SHORT_PTR:
+ value->a_short_ptr = va_arg (vaargs, short *);
+ break;
+ case VALTYPE_INT:
+ value->a_int = va_arg (vaargs, int);
+ break;
+ case VALTYPE_INT_PTR:
+ value->a_int_ptr = va_arg (vaargs, int *);
+ break;
+ case VALTYPE_UINT:
+ value->a_uint = va_arg (vaargs, unsigned int);
+ break;
+ case VALTYPE_LONG:
+ value->a_long = va_arg (vaargs, long);
+ break;
+ case VALTYPE_ULONG:
+ value->a_ulong = va_arg (vaargs, unsigned long);
+ break;
+ case VALTYPE_LONG_PTR:
+ value->a_long_ptr = va_arg (vaargs, long *);
+ break;
#ifdef HAVE_LONG_LONG_INT
- case VALTYPE_LONGLONG:
- value->a_longlong = va_arg (vaargs, long long int);
- break;
- case VALTYPE_ULONGLONG:
- value->a_ulonglong = va_arg (vaargs, unsigned long long int);
- break;
- case VALTYPE_LONGLONG_PTR:
- value->a_longlong_ptr = va_arg (vaargs, long long *);
- break;
+ case VALTYPE_LONGLONG:
+ value->a_longlong = va_arg (vaargs, long long int);
+ break;
+ case VALTYPE_ULONGLONG:
+ value->a_ulonglong = va_arg (vaargs, unsigned long long int);
+ break;
+ case VALTYPE_LONGLONG_PTR:
+ value->a_longlong_ptr = va_arg (vaargs, long long *);
+ break;
#endif
- case VALTYPE_DOUBLE:
- value->a_double = va_arg (vaargs, double);
- break;
+ case VALTYPE_DOUBLE:
+ value->a_double = va_arg (vaargs, double);
+ break;
#ifdef HAVE_LONG_DOUBLE
- case VALTYPE_LONGDOUBLE:
- value->a_longdouble = va_arg (vaargs, long double);
- break;
+ case VALTYPE_LONGDOUBLE:
+ value->a_longdouble = va_arg (vaargs, long double);
+ break;
#endif
- case VALTYPE_STRING:
- value->a_string = va_arg (vaargs, const char *);
- break;
- case VALTYPE_POINTER:
- value->a_void_ptr = va_arg (vaargs, void *);
- break;
+ case VALTYPE_STRING:
+ value->a_string = va_arg (vaargs, const char *);
+ break;
+ case VALTYPE_POINTER:
+ value->a_void_ptr = va_arg (vaargs, void *);
+ break;
#ifdef HAVE_INTMAX_T
- case VALTYPE_INTMAX:
- value->a_intmax = va_arg (vaargs, intmax_t);
- break;
- case VALTYPE_INTMAX_PTR:
- value->a_intmax_ptr = va_arg (vaargs, intmax_t *);
- break;
+ case VALTYPE_INTMAX:
+ value->a_intmax = va_arg (vaargs, intmax_t);
+ break;
+ case VALTYPE_INTMAX_PTR:
+ value->a_intmax_ptr = va_arg (vaargs, intmax_t *);
+ break;
#endif
#ifdef HAVE_UINTMAX_T
- case VALTYPE_UINTMAX:
- value->a_uintmax = va_arg (vaargs, uintmax_t);
- break;
+ case VALTYPE_UINTMAX:
+ value->a_uintmax = va_arg (vaargs, uintmax_t);
+ break;
#endif
- case VALTYPE_SIZE:
- value->a_size = va_arg (vaargs, size_t);
- break;
- case VALTYPE_SIZE_PTR:
- value->a_size_ptr = va_arg (vaargs, size_t *);
- break;
+ case VALTYPE_SIZE:
+ value->a_size = va_arg (vaargs, size_t);
+ break;
+ case VALTYPE_SIZE_PTR:
+ value->a_size_ptr = va_arg (vaargs, size_t *);
+ break;
#ifdef HAVE_PTRDIFF_T
- case VALTYPE_PTRDIFF:
- value->a_ptrdiff = va_arg (vaargs, ptrdiff_t);
- break;
- case VALTYPE_PTRDIFF_PTR:
- value->a_ptrdiff_ptr = va_arg (vaargs, ptrdiff_t *);
- break;
+ case VALTYPE_PTRDIFF:
+ value->a_ptrdiff = va_arg (vaargs, ptrdiff_t);
+ break;
+ case VALTYPE_PTRDIFF_PTR:
+ value->a_ptrdiff_ptr = va_arg (vaargs, ptrdiff_t *);
+ break;
#endif
- default: /* Unsupported type. */
- return -1;
- }
+ default: /* Unsupported type. */
+ return -1;
}
}
return 0;
More information about the Gnupg-commits
mailing list