diff options
author | Werner Koch <wk@gnupg.org> | 2008-04-18 11:44:07 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-04-18 11:44:07 +0000 |
commit | 8559c656de0c2de6013c7d705bc8fe175a6a7abb (patch) | |
tree | 2e85ee1c5f27d72c5cda238a00e5b29380345b7e /src | |
parent | 37b298a02055e027b690e643fe149754727b79db (diff) | |
download | libgcrypt-8559c656de0c2de6013c7d705bc8fe175a6a7abb.tar.gz |
Collected changes. See ChnageLogs.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/missing-string.c | 97 |
2 files changed, 5 insertions, 97 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5be65475..25faf359 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-04-18 Werner Koch <wk@g10code.com> + + * missing-string.c (vasprintf): Remove. It is not used. Reported + by Simon Josefsson. + 2008-03-11 Werner Koch <wk@g10code.com> * gcrypt.h.in (gcry_ac_em_t, gcry_ac_scheme_t): Remove trailing diff --git a/src/missing-string.c b/src/missing-string.c index 5e43b2a8..a5e56c3f 100644 --- a/src/missing-string.c +++ b/src/missing-string.c @@ -53,100 +53,3 @@ strcasecmp( const char *a, const char *b ) } #endif - -#ifdef __MINGW32__ -/* - * Like vsprintf but provides a pointer to malloc'd storage, which - * must be freed by the caller (gcry_free). Taken from libiberty as - * found in gcc-2.95.2 and a little bit modernized. - * FIXME: Write a new CRT for W32. - */ -int -vasprintf ( char **result, const char *format, va_list args) -{ - const char *p = format; - /* Add one to make sure that it is never zero, which might cause malloc - to return NULL. */ - int total_width = strlen (format) + 1; - va_list ap; - - /* this is not really portable but works under Windows */ - memcpy ( &ap, &args, sizeof (va_list)); - - while (*p != '\0') - { - if (*p++ == '%') - { - while (strchr ("-+ #0", *p)) - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - { - char *endp; - total_width += strtoul (p, &endp, 10); - p = endp; - } - if (*p == '.') - { - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - { - char *endp; - total_width += strtoul (p, &endp, 10); - p = endp; - } - } - while (strchr ("hlL", *p)) - ++p; - /* Should be big enough for any format specifier except %s - and floats. */ - total_width += 30; - switch (*p) - { - case 'd': - case 'i': - case 'o': - case 'u': - case 'x': - case 'X': - case 'c': - (void) va_arg (ap, int); - break; - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - (void) va_arg (ap, double); - /* Since an ieee double can have an exponent of 307, we'll - make the buffer wide enough to cover the gross case. */ - total_width += 307; - - case 's': - total_width += strlen (va_arg (ap, char *)); - break; - case 'p': - case 'n': - (void) va_arg (ap, char *); - break; - } - } - } - *result = gcry_malloc (total_width); - if (*result != NULL) - return vsprintf (*result, format, args); - else - return 0; -} - -#endif /*__MINGW32__*/ - |