axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r1713050 - /axis/axis2/c/core/trunk/util/src/allocator.c
Date Fri, 06 Nov 2015 22:51:32 GMT
Author: nadiramra
Date: Fri Nov  6 22:51:32 2015
New Revision: 1713050

URL: http://svn.apache.org/viewvc?rev=1713050&view=rev
Log:
Simplify code

Modified:
    axis/axis2/c/core/trunk/util/src/allocator.c

Modified: axis/axis2/c/core/trunk/util/src/allocator.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/util/src/allocator.c?rev=1713050&r1=1713049&r2=1713050&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/util/src/allocator.c (original)
+++ axis/axis2/c/core/trunk/util/src/allocator.c Fri Nov  6 22:51:32 2015
@@ -20,24 +20,41 @@
 #include <stdlib.h>
 #include <string.h>
 
-void *AXIS2_CALL axutil_allocator_malloc_impl(
+void *AXIS2_CALL
+axutil_allocator_malloc_impl(
     axutil_allocator_t * allocator,
-    size_t size);
+    size_t size)
+{
+    if (allocator)
+        return malloc(size);
+    return NULL;
+}
 
-void *AXIS2_CALL axutil_allocator_realloc_impl(
+void *AXIS2_CALL
+axutil_allocator_realloc_impl(
     axutil_allocator_t * allocator,
     void *ptr,
-    size_t size);
+    size_t size)
+{
+    if (allocator)
+        return realloc(ptr, size);
+    return NULL;
+}
 
-void AXIS2_CALL axutil_allocator_free_impl(
+void AXIS2_CALL
+axutil_allocator_free_impl(
     axutil_allocator_t * allocator,
-    void *ptr);
+    void *ptr)
+{
+    if (allocator && ptr)
+        free(ptr);
+}
 
 AXIS2_EXTERN axutil_allocator_t *AXIS2_CALL
 axutil_allocator_init(
     axutil_allocator_t * allocator)
 {
-    if(!allocator)
+    if (!allocator)
     {
         allocator = (axutil_allocator_t *)malloc(sizeof(axutil_allocator_t));
         if (allocator)
@@ -89,32 +106,6 @@ axutil_allocator_free(
     return;
 }
 
-void *AXIS2_CALL
-axutil_allocator_malloc_impl(
-    axutil_allocator_t * allocator,
-    size_t size)
-{
-    return malloc(size);
-}
-
-void *AXIS2_CALL
-axutil_allocator_realloc_impl(
-    axutil_allocator_t * allocator,
-    void *ptr,
-    size_t size)
-{
-    return realloc(ptr, size);
-}
-
-void AXIS2_CALL
-axutil_allocator_free_impl(
-    axutil_allocator_t * allocator,
-    void *ptr)
-{
-	if (ptr)
-        free(ptr);
-}
-
 AXIS2_EXTERN void AXIS2_CALL
 axutil_allocator_switch_to_global_pool(
     axutil_allocator_t * allocator)



Mime
View raw message