[svn] gcry - r1429 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Fri Apr 16 04:03:49 CEST 2010
Author: marcus
Date: 2010-04-16 04:03:49 +0200 (Fri, 16 Apr 2010)
New Revision: 1429
Modified:
trunk/src/ChangeLog
trunk/src/sexp.c
Log:
2010-04-16 Marcus Brinkmann <marcus at g10code.de>
* sexp.c: (sexp_sscan): Make it variable length, and rename the old version to ...
(vsexp_sscan): ... this new function. Also swap last two arguments.
(gcry_sexp_create): Remove dummy va_list.
(gcry_sexp_build): Use vsexp_sscan instead of sexp_sscan.
(_gcry_sexp_vbuild): Likewise.
(gcry_sexp_build_array): Remove dummy va_list.
(gcry_sexp_sscan): Likewise.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2010-04-14 14:32:53 UTC (rev 1428)
+++ trunk/src/ChangeLog 2010-04-16 02:03:49 UTC (rev 1429)
@@ -1,3 +1,13 @@
+2010-04-16 Marcus Brinkmann <marcus at g10code.de>
+
+ * sexp.c: (sexp_sscan): Make it variable length, and rename the old version to ...
+ (vsexp_sscan): ... this new function. Also swap last two arguments.
+ (gcry_sexp_create): Remove dummy va_list.
+ (gcry_sexp_build): Use vsexp_sscan instead of sexp_sscan.
+ (_gcry_sexp_vbuild): Likewise.
+ (gcry_sexp_build_array): Remove dummy va_list.
+ (gcry_sexp_sscan): Likewise.
+
2010-04-12 Brad Hards <bradh at frogmouth.net> (wk)
Spelling fixes.
Modified: trunk/src/sexp.c
===================================================================
--- trunk/src/sexp.c 2010-04-14 14:32:53 UTC (rev 1428)
+++ trunk/src/sexp.c 2010-04-16 02:03:49 UTC (rev 1429)
@@ -54,9 +54,14 @@
#define TOKEN_SPECIALS "-./_:*+="
static gcry_error_t
+vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
+ const char *buffer, size_t length, int argflag,
+ void **arg_list, va_list arg_ptr);
+
+static gcry_error_t
sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
const char *buffer, size_t length, int argflag,
- va_list arg_ptr, void **arg_list);
+ void **arg_list, ...);
/* Return true if P points to a byte containing a whitespace according
to the S-expressions definition. */
@@ -210,7 +215,6 @@
{
gcry_error_t errcode;
gcry_sexp_t se;
- volatile va_list dummy_arg_ptr;
if (!retsexp)
return gcry_error (GPG_ERR_INV_ARG);
@@ -230,7 +234,7 @@
length = strlen ((char *)buffer);
}
- errcode = sexp_sscan (&se, NULL, buffer, length, 0, dummy_arg_ptr, NULL);
+ errcode = sexp_sscan (&se, NULL, buffer, length, 0, NULL);
if (errcode)
return errcode;
@@ -973,9 +977,9 @@
* regardless whether it is needed or not.
*/
static gcry_error_t
-sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
- const char *buffer, size_t length, int argflag,
- va_list arg_ptr, void **arg_list)
+vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
+ const char *buffer, size_t length, int argflag,
+ void **arg_list, va_list arg_ptr)
{
gcry_err_code_t err = 0;
static const char tokenchars[] =
@@ -1507,6 +1511,24 @@
#undef STORE_LEN
}
+
+static gcry_error_t
+sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
+ const char *buffer, size_t length, int argflag,
+ void **arg_list, ...)
+{
+ gcry_error_t rc;
+ va_list arg_ptr;
+
+ va_start (arg_ptr, arg_list);
+ rc = vsexp_sscan (retsexp, erroff, buffer, length, argflag,
+ arg_list, arg_ptr);
+ va_end (arg_ptr);
+
+ return rc;
+}
+
+
gcry_error_t
gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff, const char *format, ...)
{
@@ -1514,8 +1536,8 @@
va_list arg_ptr;
va_start (arg_ptr, format);
- rc = sexp_sscan (retsexp, erroff, format, strlen(format), 1,
- arg_ptr, NULL);
+ rc = vsexp_sscan (retsexp, erroff, format, strlen(format), 1,
+ NULL, arg_ptr);
va_end (arg_ptr);
return rc;
@@ -1526,42 +1548,26 @@
_gcry_sexp_vbuild (gcry_sexp_t *retsexp, size_t *erroff,
const char *format, va_list arg_ptr)
{
- return sexp_sscan (retsexp, erroff, format, strlen(format), 1,
- arg_ptr, NULL);
+ return vsexp_sscan (retsexp, erroff, format, strlen(format), 1,
+ NULL, arg_ptr);
}
+
/* Like gcry_sexp_build, but uses an array instead of variable
function arguments. */
gcry_error_t
gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff,
const char *format, void **arg_list)
{
- /* We don't need the va_list because it is controlled by the
- following flag, however we have to pass it but can't initialize
- it as there is no portable way to do so. volatile is needed to
- suppress the compiler warning */
- volatile va_list dummy_arg_ptr;
-
- gcry_error_t rc;
+ return sexp_sscan (retsexp, erroff, format, strlen(format), 1, arg_list);
+}
- rc = sexp_sscan (retsexp, erroff, format, strlen(format), 1,
- dummy_arg_ptr, arg_list);
- return rc;
-}
-
gcry_error_t
gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
const char *buffer, size_t length)
{
- /* We don't need the va_list because it is controlled by the
- following flag, however we have to pass it but can't initialize
- it as there is no portable way to do so. volatile is needed to
- suppress the compiler warning */
- volatile va_list dummy_arg_ptr;
-
- return sexp_sscan (retsexp, erroff, buffer, length, 0,
- dummy_arg_ptr, NULL);
+ return sexp_sscan (retsexp, erroff, buffer, length, 0, NULL);
}
More information about the Gnupg-commits
mailing list