summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2018-12-19 09:41:41 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-12-19 11:08:59 +0100
commit5b0ff19b08979f0c4d60cafcd23fcad8d61c3cc4 (patch)
treee165038ccb8c93d6d648d05f1c3ff762f172e390 /lib
parent62f162f64c23a5e6b872ff8ee540d375b7e27168 (diff)
downloadgnutls-5b0ff19b08979f0c4d60cafcd23fcad8d61c3cc4.tar.gz
vasprintf: use from gnulib; don't bundle twice
Relates #653 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/errors.c1
-rw-r--r--lib/str.c1
-rw-r--r--lib/system/vasprintf.c84
-rw-r--r--lib/vasprintf.h12
5 files changed, 1 insertions, 99 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index e7c5c7f40e..5c0eac680c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -72,7 +72,7 @@ COBJECTS = range.c record.c compress.c debug.c cipher.c gthreads.h handshake-tls
pk.c cert-cred.c global.c constate.c anon_cred.c pkix_asn1_tab.c gnutls_asn1_tab.c \
mem.c fingerprint.c tls-sig.c ecc.c alert.c privkey_raw.c atomic.h \
system/certs.c system/threads.c system/fastopen.c system/sockets.c \
- system/inet_ntop.c str-iconv.c system/vasprintf.c vasprintf.h system.c \
+ system/inet_ntop.c str-iconv.c system.c \
str.c str-unicode.c str-idna.c state.c cert-cred-x509.c file.c supplemental.c \
random.c crypto-api.c crypto-api.h privkey.c pcert.c pubkey.c locks.c dtls.c \
system_override.c crypto-backend.c verify-tofu.c pin.c tpm.c fips.c \
diff --git a/lib/errors.c b/lib/errors.c
index acdaf65bca..a1bdf9b873 100644
--- a/lib/errors.c
+++ b/lib/errors.c
@@ -26,7 +26,6 @@
#ifdef STDC_HEADERS
#include <stdarg.h>
#endif
-#include "vasprintf.h"
#include "str.h"
#define ERROR_ENTRY(desc, name) \
diff --git a/lib/str.c b/lib/str.c
index c8d742e91e..f766915bc0 100644
--- a/lib/str.c
+++ b/lib/str.c
@@ -29,7 +29,6 @@
#include <c-ctype.h>
#include <intprops.h>
#include <nettle/base64.h>
-#include "vasprintf.h"
#include "extras/hex.h"
/* These functions are like strcat, strcpy. They only
diff --git a/lib/system/vasprintf.c b/lib/system/vasprintf.c
deleted file mode 100644
index 8362942a20..0000000000
--- a/lib/system/vasprintf.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright © 2008-2014 Intel Corporation.
- *
- * Authors: David Woodhouse <dwmw2@infradead.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-#include "vasprintf.h"
-
-#ifndef HAVE_VASPRINTF
-
-int _gnutls_vasprintf(char **strp, const char *fmt, va_list ap)
-{
- va_list ap2;
- char *res = NULL;
- int len = 160, len2;
- int ret = 0;
- int errno_save = -ENOMEM;
-
- res = malloc(160);
- if (!res)
- goto err;
-
- /* Use a copy of 'ap', preserving it in case we need to retry into
- a larger buffer. 160 characters should be sufficient for most
- strings in openconnect. */
-#ifdef HAVE_VA_COPY
- va_copy(ap2, ap);
-#elif defined(HAVE___VA_COPY)
- __va_copy(ap2, ap);
-#else
-#error No va_copy()!
- /* You could try this. */
- ap2 = ap;
- /* Or this */
- *ap2 = *ap;
-#endif
- len = vsnprintf(res, 160, fmt, ap2);
- va_end(ap2);
-
- if (len < 0) {
- printf_err:
- errno_save = errno;
- free(res);
- res = NULL;
- goto err;
- }
- if (len >= 0 && len < 160)
- goto out;
-
- free(res);
- res = malloc(len+1);
- if (!res)
- goto err;
-
- len2 = vsnprintf(res, len+1, fmt, ap);
- if (len2 < 0 || len2 > len)
- goto printf_err;
-
- ret = 0;
- goto out;
-
- err:
- errno = errno_save;
- ret = -1;
- out:
- *strp = res;
- return ret;
-}
-
-#endif
diff --git a/lib/vasprintf.h b/lib/vasprintf.h
deleted file mode 100644
index 70574806bc..0000000000
--- a/lib/vasprintf.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef VASPRINTF_H
-#define VASPRINTF_H
-#include <config.h>
-
-#ifndef HAVE_VASPRINTF
-
-int _gnutls_vasprintf(char **strp, const char *fmt, va_list ap);
-#define vasprintf _gnutls_vasprintf
-
-#endif
-
-#endif