------------------------------------------------------------ revno: 10911 revision-id: amosjeffries@squid-cache.org-20101004054442-m819obsjttxz0vmu parent: amosjeffries@squid-cache.org-20101004054322-kfcva59sw2fzknwl committer: Amos Jeffries branch nick: trunk timestamp: Sun 2010-10-03 23:44:42 -0600 message: Revert r10909 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: amosjeffries@squid-cache.org-20101004054442-\ # m819obsjttxz0vmu # target_branch: http://www.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 9cf0d956bbf6da6c3e03b079a024f9e9765230a7 # timestamp: 2010-10-04 05:53:44 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: amosjeffries@squid-cache.org-20101004054322-\ # kfcva59sw2fzknwl # # Begin patch === modified file 'compat/Makefile.am' --- compat/Makefile.am 2010-10-04 05:43:22 +0000 +++ compat/Makefile.am 2010-10-04 05:44:42 +0000 @@ -11,21 +11,16 @@ noinst_LIBRARIES = libcompat-squid.a libcompat_squid_a_SOURCES = \ - assert.cc \ assert.h \ - compat.cc \ compat.h \ compat_shared.h \ cpu.h \ - debug.cc \ debug.h \ drand48.h \ eui64_aton.h \ fdsetsize.h \ getaddrinfo.h \ getnameinfo.h \ - GnuRegex.c \ - GnuRegex.h \ inet_ntop.h \ inet_pton.h \ initgroups.h \ @@ -38,10 +33,6 @@ types.h \ unsafe.h \ valgrind.h \ - xalloc.cc \ - xalloc.h \ - xstring.cc \ - xstring.h \ \ os/aix.h \ os/dragonfly.h \ @@ -58,7 +49,13 @@ os/sgi.h \ os/solaris.h \ os/sunos.h \ - os/windows.h + os/windows.h \ + \ + assert.cc \ + compat.cc \ + debug.cc \ + GnuRegex.h \ + GnuRegex.c libcompat_squid_a_LIBADD= $(LIBOBJS) === modified file 'compat/compat.cc' --- compat/compat.cc 2010-10-04 05:43:22 +0000 +++ compat/compat.cc 2010-10-04 05:44:42 +0000 @@ -1,4 +0,0 @@ -#include "config.h" -#include "compat.h" - -void (*failure_notify) (const char *) = NULL; === modified file 'compat/compat_shared.h' --- compat/compat_shared.h 2010-10-04 05:43:22 +0000 +++ compat/compat_shared.h 2010-10-04 05:44:42 +0000 @@ -17,17 +17,6 @@ * of the requirements for wrapping your hack for safe portability. */ -/* - * Define an error display handler override. - * If error_notify is set by the linked program it will be used by the local - * portability functions. Otherwise perror() will be used. - */ -#ifdef __cplusplus -extern "C" -#else -extern -#endif -void (*failure_notify) (const char *); /* * sys/resource.h and sys/time.h are apparently order-dependant. @@ -205,11 +194,5 @@ #endif #endif -/* - * Several function definitions which we provide for security and code safety. - */ -#include "compat/xalloc.h" -#include "compat/xstring.h" - #endif /* _SQUID_COMPAT_SHARED_H */ === removed file 'compat/xalloc.cc' --- compat/xalloc.cc 2010-10-04 05:43:22 +0000 +++ compat/xalloc.cc 1970-01-01 00:00:00 +0000 @@ -1,105 +0,0 @@ -#include "config.h" -#include "compat/xalloc.h" - -void * -xcalloc(size_t n, size_t sz) -{ - void *p; - - if (n < 1) - n = 1; - - if (sz < 1) - sz = 1; - - p = calloc(n, sz); - - if (p == NULL) { - if (failure_notify) { - static char msg[128]; - snprintf(msg, 128, "xcalloc: Unable to allocate %u blocks of %u bytes!\n", - (unsigned int) n, (unsigned int) sz); - msg[127] = '\0'; - (*failure_notify) (msg); - } else { - perror("xcalloc"); - } - exit(1); - } - -#if XMALLOC_DEBUG - check_malloc(p, sz * n); -#endif -#if XMALLOC_STATISTICS - malloc_stat(sz * n); -#endif -#if XMALLOC_TRACE - xmalloc_show_trace(p, 1); -#endif -#if MEM_GEN_TRACE - if (tracefp) - fprintf(tracefp, "c:%u:%u:%p\n", (unsigned int) n, (unsigned int) sz, p); -#endif - - return p; -} - -void * -xmalloc(size_t sz) -{ - void *p; - - if (sz < 1) - sz = 1; - - p = malloc(sz); - - if (p == NULL) { - if (failure_notify) { - static char msg[128]; - snprintf(msg, 128, "xmalloc: Unable to allocate %d bytes!\n", - (int) sz); - msg[127] = '\0'; - (*failure_notify) (msg); - } else { - perror("malloc"); - } - exit(1); - } - -#if XMALLOC_DEBUG - check_malloc(p, sz); -#endif -#if XMALLOC_STATISTICS - malloc_stat(sz); -#endif -#if XMALLOC_TRACE - xmalloc_show_trace(p, 1); -#endif -#if MEM_GEN_TRACE - if (tracefp) - fprintf(tracefp, "m:%d:%p\n", sz, p); -#endif - - return (p); -} - -void -xfree(void *s) -{ -#if XMALLOC_TRACE - xmalloc_show_trace(s, -1); -#endif - - if (s != NULL) { -#if XMALLOC_DEBUG - check_free(s); -#endif - free(s); - } - -#if MEM_GEN_TRACE - if (tracefp && s) - fprintf(tracefp, "f:%p\n", s); -#endif -} === removed file 'compat/xalloc.h' --- compat/xalloc.h 2010-10-04 05:43:22 +0000 +++ compat/xalloc.h 1970-01-01 00:00:00 +0000 @@ -1,39 +0,0 @@ -#ifndef _SQUID_COMPAT_XALLOC_H -#define _SQUID_COMPAT_XALLOC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xcalloc() - same as calloc(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -void *xcalloc(size_t n, size_t sz); - -/** - * xmalloc() - same as malloc(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -void *xmalloc(size_t sz); - -/** - * xfree() - same as free(3). Used for portability. - * Will not call free(3) if s == NULL. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -void xfree(void *s); - -#ifdef __cplusplus -} -#endif - -#endif /* _SQUID_COMPAT_XALLOC_H */ === removed file 'compat/xstring.cc' --- compat/xstring.cc 2010-10-04 05:43:22 +0000 +++ compat/xstring.cc 1970-01-01 00:00:00 +0000 @@ -1,80 +0,0 @@ -#include "config.h" -#include "compat/xalloc.h" -#include "compat/xstring.h" - -#if HAVE_ERRNO_H -#include -#endif - -char * -xstrdup(const char *s) -{ - size_t sz; - char *p; - - if (s == NULL) { - if (failure_notify) { - (*failure_notify) ("xstrdup: tried to dup a NULL pointer!\n"); - } else { - errno = EINVAL; - perror("xstrdup: tried to dup a NULL pointer!"); - } - exit(1); - } - - /* copy string, including terminating character */ - sz = strlen(s) + 1; - p = (char *)xmalloc(sz); - memcpy(p, s, sz); - - return p; -} - -char * -xstrncpy(char *dst, const char *src, size_t n) -{ - char *r = dst; - - if (!n || !dst) - return dst; - - if (src) - while (--n != 0 && *src != '\0') - *dst++ = *src++; - - *dst = '\0'; - return r; -} - -char * -xstrndup(const char *s, size_t n) -{ - size_t sz; - char *p; - - if (s == NULL) { - errno = EINVAL; - if (failure_notify) { - (*failure_notify) ("xstrndup: tried to dup a NULL pointer!\n"); - } else { - perror("xstrndup: tried to dup a NULL pointer!"); - } - exit(1); - } - if (n < 0) { - errno = EINVAL; - if (failure_notify) { - (*failure_notify) ("xstrndup: tried to dup a negative length string!\n"); - } else { - perror("xstrndup: tried to dup a negative length string!"); - } - exit(1); - } - - sz = strlen(s) + 1; - if (sz > n) - sz = n; - - p = xstrncpy((char *)xmalloc(sz), s, sz); - return p; -} === removed file 'compat/xstring.h' --- compat/xstring.h 2010-10-04 05:43:22 +0000 +++ compat/xstring.h 1970-01-01 00:00:00 +0000 @@ -1,57 +0,0 @@ -#ifndef _SQUID_COMPAT_XSTRING_H -#define _SQUID_COMPAT_XSTRING_H - -#if HAVE_STRING_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xstrdup() - same as strdup(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Sets errno to EINVAL if a NULL pointer is passed. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -char *xstrdup(const char *s); - -#ifdef strdup -#undef strdup -#endif -#define strdup(X) xstrdup((X)) - -/* - * xstrncpy() - similar to strncpy(3) but terminates string - * always with '\0' if (n != 0 and dst != NULL), - * and doesn't do padding - */ -char *xstrncpy(char *dst, const char *src, size_t n); - -/** - * xstrndup() - same as strndup(3). Used for portability. - * Never returns NULL; fatal on error. - * - * Sets errno to EINVAL if a NULL pointer or negative - * length is passed. - * - * Define failure_notify to receive error message. - * otherwise perror() is used to display it. - */ -char *xstrndup(const char *s, size_t n); - -#ifdef strndup -#undef strndup -#endif -#define strndup(X) xstrndup((X)) - - -#ifdef __cplusplus -} -#endif - -#endif /* _SQUID_COMPAT_XSTRING_H */ === modified file 'configure.in' --- configure.in 2010-10-04 05:43:22 +0000 +++ configure.in 2010-10-04 05:44:42 +0000 @@ -2112,7 +2112,6 @@ bstring.h \ cassert \ crypt.h \ - cstdlib \ cstring \ ctype.h \ errno.h \ === modified file 'doc/release-notes/release-3.2.sgml' --- doc/release-notes/release-3.2.sgml 2010-10-04 05:43:22 +0000 +++ doc/release-notes/release-3.2.sgml 2010-10-04 05:44:42 +0000 @@ -301,22 +301,19 @@ New tags