jdk/src/share/demo/jvmti/hprof/hprof_util.h
changeset 13678 5c8001201f98
parent 10292 ed7db6a12c2a
child 14342 8435a30053c1
equal deleted inserted replaced
13508:7c6aa31ff1b2 13678:5c8001201f98
    38  */
    38  */
    39 
    39 
    40 
    40 
    41 #ifndef HPROF_UTIL_H
    41 #ifndef HPROF_UTIL_H
    42 #define HPROF_UTIL_H
    42 #define HPROF_UTIL_H
       
    43 
       
    44 /* Use THIS_FILE when it is available. */
       
    45 #ifndef THIS_FILE
       
    46     #define THIS_FILE __FILE__
       
    47 #endif
    43 
    48 
    44 /* Macros that protect code from accidently using a local ref improperly */
    49 /* Macros that protect code from accidently using a local ref improperly */
    45 #define WITH_LOCAL_REFS(env, number)            \
    50 #define WITH_LOCAL_REFS(env, number)            \
    46     {                                           \
    51     {                                           \
    47         JNIEnv *_env = (env);                   \
    52         JNIEnv *_env = (env);                   \
   182 #include "debug_malloc.h"
   187 #include "debug_malloc.h"
   183 
   188 
   184 #ifdef DEBUG
   189 #ifdef DEBUG
   185     void *        hprof_debug_malloc(int size, char *file, int line);
   190     void *        hprof_debug_malloc(int size, char *file, int line);
   186     void          hprof_debug_free(void *ptr, char *file, int line);
   191     void          hprof_debug_free(void *ptr, char *file, int line);
   187     #define HPROF_MALLOC(size)  hprof_debug_malloc(size, __FILE__, __LINE__)
   192     #define HPROF_MALLOC(size)  hprof_debug_malloc(size, THIS_FILE, __LINE__)
   188     #define HPROF_FREE(ptr)     hprof_debug_free(ptr, __FILE__, __LINE__)
   193     #define HPROF_FREE(ptr)     hprof_debug_free(ptr, THIS_FILE, __LINE__)
   189 #else
   194 #else
   190     #define HPROF_MALLOC(size)  hprof_malloc(size)
   195     #define HPROF_MALLOC(size)  hprof_malloc(size)
   191     #define HPROF_FREE(ptr)     hprof_free(ptr)
   196     #define HPROF_FREE(ptr)     hprof_free(ptr)
   192 #endif
   197 #endif
   193 
   198