]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
oops fix this the right way - json malloc and free
authorJeff Lenk <jeff@jefflenk.com>
Thu, 17 Jun 2010 19:17:15 +0000 (14:17 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Thu, 17 Jun 2010 19:17:15 +0000 (14:17 -0500)
libs/esl/src/esl_json.c
src/switch_json.c

index 449c31e92b5cdb9fdd99cd13d8e30bcee05a5a67..813040480a8081b878c3a4870d74012dd7e2aa42 100644 (file)
@@ -33,8 +33,18 @@ static int cJSON_strcasecmp(const char *s1,const char *s2)
        return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
 }
 
-static void *(*cJSON_malloc)(size_t sz);
-static void (*cJSON_free)(void *ptr);
+static void *glue_malloc(size_t theSize) \r
+{ \r
+       return(malloc(theSize)); \r
+} \r
+\r
+static void glue_free(void *thePtr) \r
+{ \r
+       free(thePtr); \r
+} \r
+
+static void *(*cJSON_malloc)(size_t sz) = glue_malloc;
+static void (*cJSON_free)(void *ptr) = glue_free;
 
 static char* cJSON_strdup(const char* str)
 {
index fb78a154faf8c80a87ea1c11069fce345b7bd050..c07dfa8712a31b7caa101eda453ca4a385dc5aa2 100644 (file)
@@ -33,8 +33,18 @@ static int cJSON_strcasecmp(const char *s1,const char *s2)
        return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
 }
 
-static void *(*cJSON_malloc)(size_t sz);
-static void (*cJSON_free)(void *ptr);
+static void *glue_malloc(size_t theSize) \r
+{ \r
+       return(malloc(theSize)); \r
+} \r
+\r
+static void glue_free(void *thePtr) \r
+{ \r
+       free(thePtr); \r
+} \r
+
+static void *(*cJSON_malloc)(size_t sz) = glue_malloc;
+static void (*cJSON_free)(void *ptr) = glue_free;
 
 static char* cJSON_strdup(const char* str)
 {