]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
- define isc_mem_reallocate() in the abstract API for export lib [rt20208]
authorEvan Hunt <each@isc.org>
Wed, 2 Sep 2009 23:43:54 +0000 (23:43 +0000)
committerEvan Hunt <each@isc.org>
Wed, 2 Sep 2009 23:43:54 +0000 (23:43 +0000)
- 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

config.h.win32
lib/dns/rdata/generic/hip_55.c
lib/isc/include/isc/mem.h
lib/isc/include/isc/namespace.h
lib/isc/include/isc/socket.h
lib/isc/mem.c
lib/isc/mem_api.c
lib/isc/win32/libisc.def
lib/isccfg/parser.c

index 962ffe2be82aa9d473cd98de60dbe09af4ac8a7e..301d2871f43a55b348aca69fc0d9a72d8affe526 100644 (file)
@@ -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
 /*
  * 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
index c5e0687ee254107a6d6e4a475b22230cf3cfd311..101066209f1993d477f7f1c954f98b15e9e39041 100644 (file)
@@ -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));
index 28edcb67a36003f7e91d21f010a4cac3f40bb130..ef6e3c89c9af894154dc802a9504d51e8d50916c 100644 (file)
@@ -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
 
index 9cc8d60a844f65897e50add3ecfa1926d1f54d30..24fdcecc89d898644ff78644c0cd39d897cccfaa 100644 (file)
@@ -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
index 11ee408935c16d4955f71c210a931776860f5473..376dcc09ad231faaf907349bebbd803e8d2b6c08 100644 (file)
@@ -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.
  */
index 934694f618ad157e7b6a8497c7bf3598bd63101a..ef6ece0c293844507674e0bc7dbb0a12edc8c9df 100644 (file)
@@ -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);
 }
index e50c56b8435de6deb8e88178bd3fe7b383ff2b3f..a6f2c3aa35418f184eec002c350524059949be3e 100644 (file)
@@ -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));
index cffe791c84418af14c6593bbec0a38e591f963ae..1773472802c62ba51a89298929a06d0d1101c4e0 100644 (file)
@@ -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
index 1314e7a5de5a2e60504e5857eecce1f307d41d0e..e76a53df8a857a55ecf9da89ee008c9dd49e3efe 100644 (file)
@@ -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 */
 
 #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>