gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r7641 - in libmicrohttpd/src/daemon/https: lgl tls


From: gnunet
Subject: [GNUnet-SVN] r7641 - in libmicrohttpd/src/daemon/https: lgl tls
Date: Fri, 29 Aug 2008 14:03:02 -0600 (MDT)

Author: grothoff
Date: 2008-08-29 14:03:02 -0600 (Fri, 29 Aug 2008)
New Revision: 7641

Removed:
   libmicrohttpd/src/daemon/https/lgl/asprintf.c
   libmicrohttpd/src/daemon/https/lgl/memmem.c
   libmicrohttpd/src/daemon/https/lgl/memmove.c
   libmicrohttpd/src/daemon/https/lgl/vasnprintf.h
   libmicrohttpd/src/daemon/https/lgl/vasprintf.c
Modified:
   libmicrohttpd/src/daemon/https/lgl/Makefile.am
   libmicrohttpd/src/daemon/https/tls/gnutls_str.c
Log:
removing useless code

Modified: libmicrohttpd/src/daemon/https/lgl/Makefile.am
===================================================================
--- libmicrohttpd/src/daemon/https/lgl/Makefile.am      2008-08-29 19:47:18 UTC 
(rev 7640)
+++ libmicrohttpd/src/daemon/https/lgl/Makefile.am      2008-08-29 20:03:02 UTC 
(rev 7641)
@@ -12,7 +12,6 @@
 # liblgl_la_LIBADD = ./gc-libgcrypt.lo
 
 liblgl_la_SOURCES = \
-asnprintf.c \
 sha1.c \
 gc-libgcrypt.c \
 time_r.c \
@@ -23,16 +22,10 @@
 hmac-md5.c \
 hmac-sha1.c \
 realloc.c \
-memmem.c \
-memmove.c \
 memxor.c \
 printf-args.c \
 strverscmp.c \
-snprintf.c \
-asprintf.c \
-vasprintf.c \
-vasnprintf.c \
 md5.c \
 printf-parse.c \
 des.c 
-  
\ No newline at end of file
+  

Deleted: libmicrohttpd/src/daemon/https/lgl/asprintf.c
===================================================================
--- libmicrohttpd/src/daemon/https/lgl/asprintf.c       2008-08-29 19:47:18 UTC 
(rev 7640)
+++ libmicrohttpd/src/daemon/https/lgl/asprintf.c       2008-08-29 20:03:02 UTC 
(rev 7641)
@@ -1,39 +0,0 @@
-/* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1, or (at your option)
-   any later version.
-
-   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.
-
-   You should have received a copy of the GNU Lesser General Public License 
along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#include "MHD_config.h"
-
-/* Specification.  */
-#ifdef IN_LIBASPRINTF
-# include "vasprintf.h"
-#else
-# include <stdio.h>
-#endif
-
-#include <stdarg.h>
-
-int
-asprintf (char **resultp, const char *format, ...)
-{
-  va_list args;
-  int result;
-
-  va_start (args, format);
-  result = vasprintf (resultp, format, args);
-  va_end (args);
-  return result;
-}

Deleted: libmicrohttpd/src/daemon/https/lgl/memmem.c
===================================================================
--- libmicrohttpd/src/daemon/https/lgl/memmem.c 2008-08-29 19:47:18 UTC (rev 
7640)
+++ libmicrohttpd/src/daemon/https/lgl/memmem.c 2008-08-29 20:03:02 UTC (rev 
7641)
@@ -1,61 +0,0 @@
-/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004,2007 Free Software 
Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1, or (at your option)
- any later version.
-
- 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.
-
- You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _LIBC
-#include "MHD_config.h"
-#endif
-
-#include <stddef.h>
-#include <string.h>
-
-#ifndef _LIBC
-# define __builtin_expect(expr, val)   (expr)
-#endif
-
-#undef memmem
-
-/* Return the first occurrence of NEEDLE in HAYSTACK.  */
-void *
-memmem (haystack, haystack_len, needle, needle_len)
-     const void *haystack;
-     size_t haystack_len;
-     const void *needle;
-     size_t needle_len;
-{
-  const char *begin;
-  const char *const last_possible = (const char *) haystack + haystack_len
-    - needle_len;
-
-  if (needle_len == 0)
-    /* The first occurrence of the empty string is deemed to occur at
-       the beginning of the string.  */
-    return (void *) haystack;
-
-  /* Sanity check, otherwise the loop might search through the whole
-     memory.  */
-  if (__builtin_expect (haystack_len < needle_len, 0))
-    return NULL;
-
-  for (begin = (const char *) haystack; begin <= last_possible; ++begin)
-    if (begin[0] == ((const char *) needle)[0]
-        && !memcmp ((const void *) &begin[1],
-                    (const void *) ((const char *) needle + 1),
-                    needle_len - 1))
-      return (void *) begin;
-
-  return NULL;
-}

Deleted: libmicrohttpd/src/daemon/https/lgl/memmove.c
===================================================================
--- libmicrohttpd/src/daemon/https/lgl/memmove.c        2008-08-29 19:47:18 UTC 
(rev 7640)
+++ libmicrohttpd/src/daemon/https/lgl/memmove.c        2008-08-29 20:03:02 UTC 
(rev 7641)
@@ -1,26 +0,0 @@
-/* memmove.c -- copy memory.
-   Copy LENGTH bytes from SOURCE to DEST.  Does not null-terminate.
-   In the public domain.
-   By David MacKenzie <address@hidden>.  */
-
-#include "MHD_config.h"
-
-#include <stddef.h>
-
-void *
-memmove (void *dest0, void const *source0, size_t length)
-{
-  char *dest = dest0;
-  char const *source = source0;
-  if (source < dest)
-    /* Moving from low mem to hi mem; start at end.  */
-    for (source += length, dest += length; length; --length)
-      *--dest = *--source;
-  else if (source != dest)
-    {
-      /* Moving from hi mem to low mem; start at beginning.  */
-      for (; length; --length)
-        *dest++ = *source++;
-    }
-  return dest0;
-}

Deleted: libmicrohttpd/src/daemon/https/lgl/vasnprintf.h
===================================================================
--- libmicrohttpd/src/daemon/https/lgl/vasnprintf.h     2008-08-29 19:47:18 UTC 
(rev 7640)
+++ libmicrohttpd/src/daemon/https/lgl/vasnprintf.h     2008-08-29 20:03:02 UTC 
(rev 7641)
@@ -1,84 +0,0 @@
-/* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1, or (at your option)
-   any later version.
-
-   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.
-
-   You should have received a copy of the GNU Lesser General Public License 
along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef _VASNPRINTF_H
-#define _VASNPRINTF_H
-
-/* Get va_list.  */
-#include <stdarg.h>
-
-/* Get size_t.  */
-#include <stddef.h>
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-#  define __attribute__(Spec)   /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* Write formatted output to a string dynamically allocated with malloc().
-   You can pass a preallocated buffer for the result in RESULTBUF and its
-   size in *LENGTHP; otherwise you pass RESULTBUF = NULL.
-   If successful, return the address of the string (this may be = RESULTBUF
-   if no dynamic memory allocation was necessary) and set *LENGTHP to the
-   number of resulting bytes, excluding the trailing NUL.  Upon error, set
-   errno and return NULL.
-
-   When dynamic memory allocation occurs, the preallocated buffer is left
-   alone (with possibly modified contents).  This makes it possible to use
-   a statically allocated or stack-allocated buffer, like this:
-
-          char buf[100];
-          size_t len = sizeof (buf);
-          char *output = vasnprintf (buf, &len, format, args);
-          if (output == NULL)
-            ... error handling ...;
-          else
-            {
-              ... use the output string ...;
-              if (output != buf)
-                free (output);
-            }
-  */
-#if REPLACE_VASNPRINTF
-# define asnprintf rpl_asnprintf
-# define vasnprintf rpl_vasnprintf
-#endif
-  extern char *asnprintf (char *resultbuf, size_t * lengthp,
-                          const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 3, 4)));
-  extern char *vasnprintf (char *resultbuf, size_t * lengthp,
-                           const char *format, va_list args)
-    __attribute__ ((__format__ (__printf__, 3, 0)));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif                          /* _VASNPRINTF_H */

Deleted: libmicrohttpd/src/daemon/https/lgl/vasprintf.c
===================================================================
--- libmicrohttpd/src/daemon/https/lgl/vasprintf.c      2008-08-29 19:47:18 UTC 
(rev 7640)
+++ libmicrohttpd/src/daemon/https/lgl/vasprintf.c      2008-08-29 20:03:02 UTC 
(rev 7641)
@@ -1,56 +0,0 @@
-/* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1, or (at your option)
-   any later version.
-
-   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.
-
-   You should have received a copy of the GNU Lesser General Public License 
along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#include "MHD_config.h"
-
-/* Specification.  */
-#ifdef IN_LIBASPRINTF
-# include "vasprintf.h"
-#else
-# include <stdio.h>
-#endif
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#include "vasnprintf.h"
-
-/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW.  */
-#ifndef EOVERFLOW
-# define EOVERFLOW E2BIG
-#endif
-
-int
-vasprintf (char **resultp, const char *format, va_list args)
-{
-  size_t length;
-  char *result = vasnprintf (NULL, &length, format, args);
-  if (result == NULL)
-    return -1;
-
-  if (length > INT_MAX)
-    {
-      free (result);
-      errno = EOVERFLOW;
-      return -1;
-    }
-
-  *resultp = result;
-  /* Return the number of resulting bytes, excluding the trailing NUL.  */
-  return length;
-}

Modified: libmicrohttpd/src/daemon/https/tls/gnutls_str.c
===================================================================
--- libmicrohttpd/src/daemon/https/tls/gnutls_str.c     2008-08-29 19:47:18 UTC 
(rev 7640)
+++ libmicrohttpd/src/daemon/https/tls/gnutls_str.c     2008-08-29 20:03:02 UTC 
(rev 7641)
@@ -236,12 +236,18 @@
   char *str;
 
   va_start (args, fmt);
-  len = vasprintf (&str, fmt, args);
+  len = vsnprintf (NULL, 0, fmt, args);
   va_end (args);
-
-  if (len < 0 || !str)
+  if (len < 0)
     return -1;
+  str = malloc(len + 1);
+  if (! str)
+    return -1;
 
+  va_start (args, fmt);
+  len = vsprintf (str, fmt, args);
+  va_end (args);
+
   len = mhd_gtls_string_append_str (dest, str);
 
   free (str);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]