]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
jinmei's updated mem.h, which uses macros to generate function prototypes.
authorEvan Hunt <each@isc.org>
Fri, 4 Sep 2009 17:47:26 +0000 (17:47 +0000)
committerEvan Hunt <each@isc.org>
Fri, 4 Sep 2009 17:47:26 +0000 (17:47 +0000)
this change was needed to support the bind9 build and export library build
on both *nix and win32.  cleanup from change 2660/rt19369.

lib/isc/include/isc/mem.h

index ef6e3c89c9af894154dc802a9504d51e8d50916c..c043e6924c23a99b8acb124e5f5ef4f4ccefe603 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: mem.h,v 1.84 2009/09/02 23:43:54 each Exp $ */
+/* $Id: mem.h,v 1.85 2009/09/04 17:47:26 each Exp $ */
 
 #ifndef ISC_MEM_H
 #define ISC_MEM_H 1
@@ -152,11 +152,19 @@ 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)
+#ifdef WIN32
+#define ISCMEMFUNC(sfx) isc___mem_ ## sfx
+#define ISCMEMPOOLFUNC(sfx) isc___mempool_ ## sfx
+#else
+#define ISCMEMFUNC(sfx) isc__mem_ ## sfx
+#define ISCMEMPOOLFUNC(sfx) isc__mempool_ ## sfx
+#endif
+
+#define isc_mem_get(c, s)      ISCMEMFUNC(get)((c), (s) _ISC_MEM_FILELINE)
+#define isc_mem_allocate(c, s) ISCMEMFUNC(allocate)((c), (s) _ISC_MEM_FILELINE)
+#define isc_mem_reallocate(c, p, s) ISCMEMFUNC(reallocate)((c), (p), (s) _ISC_MEM_FILELINE)
+#define isc_mem_strdup(c, p)   ISCMEMFUNC(strdup)((c), (p) _ISC_MEM_FILELINE)
+#define isc_mempool_get(c)     ISCMEMPOOLFUNC(get)((c) _ISC_MEM_FILELINE)
 
 /*%
  * isc_mem_putanddetach() is a convenience function for use where you
@@ -258,30 +266,30 @@ struct isc_mempool {
 #if ISC_MEM_DEBUG
 #define isc_mem_put(c, p, s) \
        do { \
-               isc___mem_put((c), (p), (s) _ISC_MEM_FILELINE); \
+               ISCMEMFUNC(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); \
+               ISCMEMFUNC(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); \
+               ISCMEMFUNC(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); \
+               ISCMEMPOOLFUNC(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)   ISCMEMFUNC(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)
-#define isc_mempool_put(c, p)  isc__mempool_put((c), (p) _ISC_MEM_FILELINE)
+       ISCMEMFUNC(putanddetach)((c), (p), (s) _ISC_MEM_FILELINE)
+#define isc_mem_free(c, p)     ISCMEMFUNC(free)((c), (p) _ISC_MEM_FILELINE)
+#define isc_mempool_put(c, p)  ISCMEMPOOLFUNC(put)((c), (p) _ISC_MEM_FILELINE)
 #endif
 
 /*@{*/
@@ -673,23 +681,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);
+ISCMEMFUNC(get)(isc_mem_t *, size_t _ISC_MEM_FLARG);
 void
-isc___mem_putanddetach(isc_mem_t **, void *, size_t _ISC_MEM_FLARG);
+ISCMEMFUNC(putanddetach)(isc_mem_t **, void *, size_t _ISC_MEM_FLARG);
 void
-isc___mem_put(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
+ISCMEMFUNC(put)(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
 void *
-isc___mem_allocate(isc_mem_t *, size_t _ISC_MEM_FLARG);
+ISCMEMFUNC(allocate)(isc_mem_t *, size_t _ISC_MEM_FLARG);
 void *
-isc___mem_reallocate(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
+ISCMEMFUNC(reallocate)(isc_mem_t *, void *, size_t _ISC_MEM_FLARG);
 void
-isc___mem_free(isc_mem_t *, void * _ISC_MEM_FLARG);
+ISCMEMFUNC(free)(isc_mem_t *, void * _ISC_MEM_FLARG);
 char *
-isc___mem_strdup(isc_mem_t *, const char *_ISC_MEM_FLARG);
+ISCMEMFUNC(strdup)(isc_mem_t *, const char *_ISC_MEM_FLARG);
 void *
-isc___mempool_get(isc_mempool_t * _ISC_MEM_FLARG);
+ISCMEMPOOLFUNC(get)(isc_mempool_t * _ISC_MEM_FLARG);
 void
-isc___mempool_put(isc_mempool_t *, void * _ISC_MEM_FLARG);
+ISCMEMPOOLFUNC(put)(isc_mempool_t *, void * _ISC_MEM_FLARG);
 
 #ifdef USE_MEMIMPREGISTER