LIBGCRYPT-1-2-BRANCH libgcrypt/src (ChangeLog g10lib.h
missing-string.c)
cvs user wk
cvs at cvs.gnupg.org
Mon Dec 6 18:28:35 CET 2004
Date: Monday, December 6, 2004 @ 18:36:34
Author: wk
Path: /cvs/libgcrypt/libgcrypt/src
Tag: LIBGCRYPT-1-2-BRANCH
Modified: ChangeLog g10lib.h missing-string.c
* g10lib.h (stpcpy, strcasecmp): Prefix them with _gcry_ and add
macros to define them to the real name. This is needed to avoid
double symbols when using static linkage.
* missing-string.c: Likewise.
(vasprintf): Removed as it is not used anywhere.
------------------+
ChangeLog | 8 ++++
g10lib.h | 10 +++--
missing-string.c | 102 +----------------------------------------------------
3 files changed, 16 insertions(+), 104 deletions(-)
Index: libgcrypt/src/ChangeLog
diff -u libgcrypt/src/ChangeLog:1.151.2.8 libgcrypt/src/ChangeLog:1.151.2.9
--- libgcrypt/src/ChangeLog:1.151.2.8 Fri Nov 26 17:27:08 2004
+++ libgcrypt/src/ChangeLog Mon Dec 6 18:36:34 2004
@@ -1,3 +1,11 @@
+2004-12-06 Werner Koch <wk at g10code.com>
+
+ * g10lib.h (stpcpy, strcasecmp): Prefix them with _gcry_ and add
+ macros to define them to the real name. This is needed to avoid
+ double symbols when using static linkage.
+ * missing-string.c: Likewise.
+ (vasprintf): Removed as it is not used anywhere.
+
2004-11-26 Werner Koch <wk at g10code.com>
* types.h [_WIN32]: Avoid warning about double defined type byte.
Index: libgcrypt/src/g10lib.h
diff -u libgcrypt/src/g10lib.h:1.26 libgcrypt/src/g10lib.h:1.26.2.1
--- libgcrypt/src/g10lib.h:1.26 Fri Dec 19 20:50:14 2003
+++ libgcrypt/src/g10lib.h Mon Dec 6 18:36:34 2004
@@ -131,12 +131,14 @@
gcry_mpi_t g, gcry_mpi_t **factors );
-/* replacements of missing functions (missing-string.c)*/
+/* Replacements of missing functions (missing-string.c)*/
#ifndef HAVE_STPCPY
-char *stpcpy (char *a, const char *b);
+char *_gcry_stpcpy (char *a, const char *b);
+#define stpcpy(a,b) _gcry_stpcpy ((a), (b))
#endif
#ifndef HAVE_STRCASECMP
-int strcasecmp (const char *a, const char *b) GCC_ATTR_PURE;
+int _gcry_strcasecmp (const char *a, const char *b) GCC_ATTR_PURE;
+#define strcasecmp(a,b) _gcry_strcasecmp ((a), (b))
#endif
/* macros used to rename missing functions */
@@ -153,7 +155,7 @@
#define atexit(a) (on_exit((a),0))
#endif
#ifndef HAVE_RAISE
-#define raise(a) kill(getpid(), (a))
+#define raise(a) kill(getpid(), (a))
#endif
Index: libgcrypt/src/missing-string.c
diff -u libgcrypt/src/missing-string.c:1.7 libgcrypt/src/missing-string.c:1.7.2.1
--- libgcrypt/src/missing-string.c:1.7 Thu Apr 15 11:00:22 2004
+++ libgcrypt/src/missing-string.c Mon Dec 6 18:36:34 2004
@@ -29,7 +29,7 @@
#ifndef HAVE_STPCPY
char *
-stpcpy(char *a,const char *b)
+_gcry_stpcpy(char *a,const char *b)
{
while( *b )
*a++ = *b++;
@@ -42,7 +42,7 @@
#ifndef HAVE_STRCASECMP
int
-strcasecmp( const char *a, const char *b )
+_gcry_strcasecmp( const char *a, const char *b )
{
for( ; *a && *b; a++, b++ ) {
if( *a != *b && toupper(*a) != toupper(*b) )
@@ -51,101 +51,3 @@
return *(const byte*)a - *(const byte*)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__*/
-
More information about the Gnupg-commits
mailing list