Commit e7c38ca9 authored by Evan Hunt's avatar Evan Hunt

- define isc_mem_reallocate() in the abstract API for export lib [rt20208]

- define BIND9 in config.h.win32
- fix problems in mem.h caused by the win32 preprocessor failing to
  expand macros used within macros
- silence a win32 compiler warning in hip_55.c
parent 9cd5eb6f
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.h.win32,v 1.21 2009/07/17 23:47:40 tbox Exp $ */
/* $Id: config.h.win32,v 1.22 2009/09/02 23:43:54 each Exp $ */
/*
* win32 configuration file
......@@ -51,7 +51,10 @@
/*
* Windows NT and 2K only
*/
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
......@@ -239,3 +242,9 @@ typedef long off_t;
* Define if libxml2 is present
*/
#define HAVE_LIBXML2 1
/*
* Define when building BIND9. When building exportable versions
* of libisc, libdns, etc, this must be removed.
*/
#define BIND9 1
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: hip_55.c,v 1.3 2009/02/26 11:18:56 tbox Exp $ */
/* $Id: hip_55.c,v 1.4 2009/09/02 23:43:54 each Exp $ */
/* reviewed: TBC */
......@@ -215,7 +215,7 @@ fromwire_hip(ARGS_FROMWIRE) {
if (key_len == 0)
RETERR(DNS_R_FORMERR);
isc_region_consume(&region, 2);
if (region.length < hit_len + key_len)
if (region.length < (unsigned) (hit_len + key_len))
RETERR(DNS_R_FORMERR);
RETERR(mem_tobuffer(target, rr.base, 4 + hit_len + key_len));
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mem.h,v 1.83 2009/09/01 23:47:44 tbox Exp $ */
/* $Id: mem.h,v 1.84 2009/09/02 23:43:54 each Exp $ */
#ifndef ISC_MEM_H
#define ISC_MEM_H 1
......@@ -152,11 +152,11 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_debugging;
#endif
#define isc_mem_get(c, s) isc__mem_get((c), (s) _ISC_MEM_FILELINE)
#define isc_mem_allocate(c, s) isc__mem_allocate((c), (s) _ISC_MEM_FILELINE)
#define isc_mem_reallocate(c, p, s) isc__mem_reallocate((c), (p), (s) _ISC_MEM_FILELINE)
#define isc_mem_strdup(c, p) isc__mem_strdup((c), (p) _ISC_MEM_FILELINE)
#define isc_mempool_get(c) isc__mempool_get((c) _ISC_MEM_FILELINE)
#define isc_mem_get(c, s) isc___mem_get((c), (s) _ISC_MEM_FILELINE)
#define isc_mem_allocate(c, s) isc___mem_allocate((c), (s) _ISC_MEM_FILELINE)
#define isc_mem_reallocate(c, p, s) isc___mem_reallocate((c), (p), (s) _ISC_MEM_FILELINE)
#define isc_mem_strdup(c, p) isc___mem_strdup((c), (p) _ISC_MEM_FILELINE)
#define isc_mempool_get(c) isc___mempool_get((c) _ISC_MEM_FILELINE)
/*%
* isc_mem_putanddetach() is a convenience function for use where you
......@@ -197,6 +197,8 @@ typedef struct isc_memmethods {
void (*memputanddetach)(isc_mem_t **mctxp, void *ptr,
size_t size _ISC_MEM_FLARG);
void *(*memallocate)(isc_mem_t *mctx, size_t size _ISC_MEM_FLARG);
void *(*memreallocate)(isc_mem_t *mctx, void *ptr,
size_t size _ISC_MEM_FLARG);
char *(*memstrdup)(isc_mem_t *mctx, const char *s _ISC_MEM_FLARG);
void (*memfree)(isc_mem_t *mctx, void *ptr _ISC_MEM_FLARG);
void (*setdestroycheck)(isc_mem_t *mctx, isc_boolean_t flag);
......@@ -256,29 +258,29 @@ struct isc_mempool {
#if ISC_MEM_DEBUG
#define isc_mem_put(c, p, s) \
do { \
isc__mem_put((c), (p), (s) _ISC_MEM_FILELINE); \
isc___mem_put((c), (p), (s) _ISC_MEM_FILELINE); \
(p) = NULL; \
} while (0)
#define isc_mem_putanddetach(c, p, s) \
do { \
isc__mem_putanddetach((c), (p), (s) _ISC_MEM_FILELINE); \
isc___mem_putanddetach((c), (p), (s) _ISC_MEM_FILELINE); \
(p) = NULL; \
} while (0)
#define isc_mem_free(c, p) \
do { \
isc__mem_free((c), (p) _ISC_MEM_FILELINE); \
isc___mem_free((c), (p) _ISC_MEM_FILELINE); \
(p) = NULL; \
} while (0)
#define isc_mempool_put(c, p) \
do { \
isc__mempool_put((c), (p) _ISC_MEM_FILELINE); \
isc___mempool_put((c), (p) _ISC_MEM_FILELINE); \
(p) = NULL; \
} while (0)
#else
#define isc_mem_put(c, p, s) isc__mem_put((c), (p), (s) _ISC_MEM_FILELINE)
#define isc_mem_put(c, p, s) isc___mem_put((c), (p), (s) _ISC_MEM_FILELINE)
#define isc_mem_putanddetach(c, p, s) \
isc__mem_putanddetach((c), (p), (s) _ISC_MEM_FILELINE)
#define isc_mem_free(c, p) isc__mem_free((c), (p) _ISC_MEM_FILELINE)
isc___mem_putanddetach((c), (p), (s) _ISC_MEM_FILELINE)
#define isc_mem_free(c, p) isc___mem_free((c), (p) _ISC_MEM_FILELINE)
#define isc_mempool_put(c, p) isc__mempool_put((c), (p) _ISC_MEM_FILELINE)
#endif
......@@ -671,23 +673,23 @@ isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit);
* Pseudo-private functions for use via macros. Do not call directly.
*/
void *
isc__mem_get(isc_mem_t *, size_t _ISC_MEM_FLARG);
isc___mem_get(isc_mem_t *, size_t _ISC_MEM_FLARG);
void
isc__mem_putanddetach(isc_mem_t **, void *, size_t _ISC_MEM_FLARG);
isc___mem_putanddetach(isc_mem_t **, void *, size_t _ISC_MEM_FLARG);
void
isc__mem_put(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
isc___mem_put(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
void *
isc__mem_allocate(isc_mem_t *, size_t _ISC_MEM_FLARG);
isc___mem_allocate(isc_mem_t *, size_t _ISC_MEM_FLARG);
void *
isc__mem_reallocate(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
isc___mem_reallocate(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
void
isc__mem_free(isc_mem_t *, void * _ISC_MEM_FLARG);
isc___mem_free(isc_mem_t *, void * _ISC_MEM_FLARG);
char *
isc__mem_strdup(isc_mem_t *, const char *_ISC_MEM_FLARG);
isc___mem_strdup(isc_mem_t *, const char *_ISC_MEM_FLARG);
void *
isc__mempool_get(isc_mempool_t * _ISC_MEM_FLARG);
isc___mempool_get(isc_mempool_t * _ISC_MEM_FLARG);
void
isc__mempool_put(isc_mempool_t *, void * _ISC_MEM_FLARG);
isc___mempool_put(isc_mempool_t *, void * _ISC_MEM_FLARG);
#ifdef USE_MEMIMPREGISTER
......
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: namespace.h,v 1.2 2009/09/01 00:22:28 jinmei Exp $ */
/* $Id: namespace.h,v 1.3 2009/09/02 23:43:54 each Exp $ */
#ifndef ISCAPI_NAMESPACE_H
#define ISCAPI_NAMESPACE_H 1
......@@ -59,6 +59,7 @@
#define isc__mem_allocate isc___mem_allocate
#define isc__mem_free isc___mem_free
#define isc__mem_strdup isc___mem_strdup
#define isc__mem_reallocate isc___mem_reallocate
#define isc_mem_references isc__mem_references
#define isc_mem_setdestroycheck isc__mem_setdestroycheck
#define isc_mem_setquota isc__mem_setquota
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.h,v 1.92 2009/09/02 18:32:25 each Exp $ */
/* $Id: socket.h,v 1.93 2009/09/02 23:43:54 each Exp $ */
#ifndef ISC_SOCKET_H
#define ISC_SOCKET_H 1
......@@ -1068,7 +1068,7 @@ void *isc_socket_gettag(isc_socket_t *socket);
*/
void
isc_socketmgr_setreserved(isc_socketmgr_t *mgr, isc_uint32_t);
isc__socketmgr_setreserved(isc_socketmgr_t *mgr, isc_uint32_t);
/*%<
* Temporary. For use by named only.
*/
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mem.c,v 1.152 2009/09/02 04:25:19 jinmei Exp $ */
/* $Id: mem.c,v 1.153 2009/09/02 23:43:54 each Exp $ */
/*! \file */
......@@ -255,6 +255,8 @@ ISC_MEMFUNC_SCOPE void
isc__mem_stats(isc_mem_t *ctx, FILE *out);
ISC_MEMFUNC_SCOPE void *
isc___mem_allocate(isc_mem_t *ctx, size_t size FLARG);
ISC_MEMFUNC_SCOPE void *
isc___mem_reallocate(isc_mem_t *ctx, void *ptr, size_t size FLARG);
ISC_MEMFUNC_SCOPE void
isc___mem_free(isc_mem_t *ctx, void *ptr FLARG);
ISC_MEMFUNC_SCOPE char *
......@@ -336,6 +338,7 @@ static struct isc__memmethods {
isc___mem_put,
isc___mem_putanddetach,
isc___mem_allocate,
isc___mem_reallocate,
isc___mem_strdup,
isc___mem_free,
isc__mem_setdestroycheck,
......@@ -1545,8 +1548,9 @@ isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) {
return (si);
}
void *
isc__mem_reallocate(isc_mem_t *ctx, void *ptr, size_t size FLARG) {
ISC_MEMFUNC_SCOPE void *
isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) {
isc__mem_t *ctx = (isc__mem_t *)ctx0;
void *new_ptr = NULL;
size_t oldsize, copysize;
......@@ -1564,17 +1568,17 @@ isc__mem_reallocate(isc_mem_t *ctx, void *ptr, size_t size FLARG) {
* NULL if allocation fails or doesn't happen.
*/
if (size > 0U) {
new_ptr = isc__mem_allocate(ctx, size FLARG_PASS);
new_ptr = isc__mem_allocate(ctx0, size FLARG_PASS);
if (new_ptr != NULL && ptr != NULL) {
oldsize = (((size_info *)ptr)[-1]).u.size;
INSIST(oldsize >= ALIGNMENT_SIZE);
oldsize -= ALIGNMENT_SIZE;
copysize = oldsize > size ? size : oldsize;
memcpy(new_ptr, ptr, copysize);
isc__mem_free(ctx, ptr FLARG_PASS);
isc__mem_free(ctx0, ptr FLARG_PASS);
}
} else if (ptr != NULL)
isc__mem_free(ctx, ptr FLARG_PASS);
isc__mem_free(ctx0, ptr FLARG_PASS);
return (new_ptr);
}
......
......@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mem_api.c,v 1.3 2009/09/01 03:43:27 jinmei Exp $ */
/* $Id: mem_api.c,v 1.4 2009/09/02 23:43:54 each Exp $ */
#include <config.h>
......@@ -148,6 +148,13 @@ isc__mem_allocate(isc_mem_t *mctx, size_t size FLARG) {
return (mctx->methods->memallocate(mctx, size FLARG_PASS));
}
void *
isc__mem_reallocate(isc_mem_t *mctx, void *ptr, size_t size FLARG) {
REQUIRE(ISCAPI_MCTX_VALID(mctx));
return (mctx->methods->memreallocate(mctx, ptr, size FLARG_PASS));
}
char *
isc__mem_strdup(isc_mem_t *mctx, const char *s FLARG) {
REQUIRE(ISCAPI_MCTX_VALID(mctx));
......
......@@ -51,6 +51,7 @@ isc__app_unblock
isc_assertion_setcallback
isc_assertion_typetotext
isc_backtrace_getsymbol
isc_backtrace_getsymbolfromindex
isc_backtrace_gettrace
isc_base32_decoderegion
isc_base32_decodestring
......@@ -128,6 +129,7 @@ isc_file_renameunique
isc_file_safecreate
isc_file_safemovefile
isc_file_settime
isc_file_splitpath
isc_file_template
isc_file_truncate
isc_fsaccess_add
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: parser.c,v 1.131 2009/06/11 23:47:55 tbox Exp $ */
/* $Id: parser.c,v 1.132 2009/09/02 23:43:54 each Exp $ */
/*! \file */
......@@ -29,12 +29,12 @@
#include <isc/mem.h>
#include <isc/net.h>
#include <isc/netaddr.h>
#include <isc/netscope.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/sockaddr.h>
#include <isc/netscope.h>
#include <isc/util.h>
#include <isc/symtab.h>
#include <isc/util.h>
#include <isccfg/cfg.h>
#include <isccfg/grammar.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment