trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1166435 - in /trafficserver/traffic/trunk: lib/ts/ proxy/http/ proxy/http/remap/
Date Wed, 07 Sep 2011 22:01:57 GMT
Author: zwoop
Date: Wed Sep  7 22:01:57 2011
New Revision: 1166435

URL: http://svn.apache.org/viewvc?rev=1166435&view=rev
Log:
TS-567 Change xfree_null to ats_free_null

Modified:
    trafficserver/traffic/trunk/lib/ts/ink_memory.cc
    trafficserver/traffic/trunk/lib/ts/ink_memory.h
    trafficserver/traffic/trunk/lib/ts/ink_resource.cc
    trafficserver/traffic/trunk/lib/ts/ink_resource.h
    trafficserver/traffic/trunk/proxy/http/HttpBodyFactory.cc
    trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
    trafficserver/traffic/trunk/proxy/http/remap/AclFiltering.cc
    trafficserver/traffic/trunk/proxy/http/remap/StringHash.cc
    trafficserver/traffic/trunk/proxy/http/remap/UrlMapping.cc
    trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc

Modified: trafficserver/traffic/trunk/lib/ts/ink_memory.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_memory.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_memory.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_memory.cc Wed Sep  7 22:01:57 2011
@@ -161,3 +161,11 @@ ats_free(void *ptr)
   if (likely(ptr != NULL))
     free(ptr);
 }                               /* End ats_free */
+
+void*
+ats_free_null(void *ptr)
+{
+  if (likely(ptr != NULL))
+    free(ptr);
+  return NULL;
+}                               /* End ats_free_null */

Modified: trafficserver/traffic/trunk/lib/ts/ink_memory.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_memory.h?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_memory.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_memory.h Wed Sep  7 22:01:57 2011
@@ -35,6 +35,7 @@ extern "C"
   void *ats_realloc(void *ptr, size_t size);
   void *ats_memalign(size_t alignment, size_t size);
   void ats_free(void *ptr);
+  void* ats_free_null(void *ptr);
   void ats_memalign_free(void *ptr);
 
 #ifdef __cplusplus

Modified: trafficserver/traffic/trunk/lib/ts/ink_resource.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_resource.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_resource.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_resource.cc Wed Sep  7 22:01:57 2011
@@ -34,15 +34,6 @@ volatile int res_track_memory = RES_TRAC
 /*-------------------------------------------------------------------------
 -------------------------------------------------------------------------*/
 void *
-_xfree_null(void *mem)
-{
-  if (likely(mem))
-    ats_free(mem);
-  return NULL;
-}
-
-
-void *
 _xrealloc(void *ptr, unsigned int size, const char *path)
 {
   NOWARN_UNUSED(path);

Modified: trafficserver/traffic/trunk/lib/ts/ink_resource.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_resource.h?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_resource.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_resource.h Wed Sep  7 22:01:57 2011
@@ -53,16 +53,6 @@ struct Resource
 // with jemalloc / tcmalloc's features of enabling memory debugging.
 #define RES_TRACK_MEMORY_DEFAULT 0      /* default value for res_track_memory variable */
 
-#ifdef __cplusplus
-
-static inline void *
-xfree_null(void *mem)
-{
-  if (mem)
-    ats_free(mem);
-  return NULL;
-}
-#endif
 
 #define xrealloc(p,s)     ats_realloc ((p),(s))
 #define xstrdup(p)        _xstrdup ((p), -1, NULL)
@@ -70,7 +60,6 @@ xfree_null(void *mem)
 
 void *_xrealloc(void *ptr, unsigned int size, const char *path);
 char *_xstrdup(const char *str, int length, const char *path);
-void *_xfree_null(void *ptr);
 
 void xdump(void);
 

Modified: trafficserver/traffic/trunk/proxy/http/HttpBodyFactory.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpBodyFactory.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpBodyFactory.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpBodyFactory.cc Wed Sep  7 22:01:57 2011
@@ -157,7 +157,7 @@ HttpBodyFactory::fabricate_with_old_api(
                  set, type, *resulting_buffer_length, max_buffer_length);
     }
     *resulting_buffer_length = 0;
-    buffer = (char *) xfree_null(buffer);
+    buffer = (char *)ats_free_null(buffer);
   }
   /////////////////////////////////////////////////////////////////////
   // handle return of instantiated template or internal default, and //

Modified: trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpConfig.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpConfig.cc Wed Sep  7 22:01:57 2011
@@ -1809,7 +1809,7 @@ HttpUserAgent_RegxEntry::create(char *_r
   char *c, *refexp_str, refexp_str_buf[2048];
   bool retcode = false;
 
-  user_agent_str = (char *) xfree_null(user_agent_str);
+  user_agent_str = (char *)ats_free_null(user_agent_str);
   user_agent_str_size = 0;
   stype = STRTYPE_UNKNOWN;
   if (regx_valid) {
@@ -1856,7 +1856,7 @@ HttpUserAgent_RegxEntry::create(char *_r
         if (regx == NULL) {
           if (errmsgbuf && (errmsgbuf_size - 1) > 0)
             ink_strncpy(errmsgbuf, error, errmsgbuf_size - 1);
-          user_agent_str = (char *) xfree_null(user_agent_str);
+          user_agent_str = (char *)ats_free_null(user_agent_str);
           retcode = false;
         } else
           regx_valid = true;

Modified: trafficserver/traffic/trunk/proxy/http/remap/AclFiltering.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/AclFiltering.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/AclFiltering.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/AclFiltering.cc Wed Sep  7 22:01:57 2011
@@ -34,7 +34,7 @@ acl_filter_rule::reset(void)
 {
   int i;
   for (i = (argc = 0); i < ACL_FILTER_MAX_ARGV; i++) {
-    argv[i] = (char *) xfree_null(argv[i]);
+    argv[i] = (char *)ats_free_null(argv[i]);
   }
   for (i = (method_cnt = 0); i < ACL_FILTER_MAX_METHODS; i++) {
     method_array[i] = 0;
@@ -79,7 +79,7 @@ int
 acl_filter_rule::name(const char *_name)
 {
   filter_name_size = 0;
-  filter_name = (char *) xfree_null(filter_name);
+  filter_name = (char *)ats_free_null(filter_name);
   if (_name && _name[0] && (filter_name = xstrdup(_name)) != NULL) {
     filter_name_size = strlen(filter_name);
   }

Modified: trafficserver/traffic/trunk/proxy/http/remap/StringHash.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/StringHash.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/StringHash.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/StringHash.cc Wed Sep  7 22:01:57 2011
@@ -70,7 +70,7 @@ StringHash::~StringHash()
         delete he;
       }
     }
-    hash = (StringHashEntry **) xfree_null(hash);
+    hash = (StringHashEntry **)ats_free_null(hash);
   }
 }
 
@@ -176,8 +176,7 @@ StringHash::find_or_add(void *_ptr, cons
 // ===============================================================================
 StringHashEntry & StringHashEntry::clean()
 {
-  if (str)
-    str = (char *) xfree_null(str);
+  str = (char *)ats_free_null(str);
   hash_table_index = (strsize = 0);
   hashid = 0;
   return *this;

Modified: trafficserver/traffic/trunk/proxy/http/remap/UrlMapping.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/UrlMapping.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/UrlMapping.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/UrlMapping.cc Wed Sep  7 22:01:57 2011
@@ -90,13 +90,8 @@ url_mapping::~url_mapping()
   redirect_tag_str *rc;
   acl_filter_rule *afr;
 
-  if (tag) {
-    tag = (char *) xfree_null(tag);
-  }
-
-  if (filter_redirect_url) {
-    filter_redirect_url = (char *) xfree_null(filter_redirect_url);
-  }
+  tag = (char *)ats_free_null(tag);
+  filter_redirect_url = (char *)ats_free_null(filter_redirect_url);
 
   while ((r = referer_list) != 0) {
     referer_list = r->next;

Modified: trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc?rev=1166435&r1=1166434&r2=1166435&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc Wed Sep  7 22:01:57 2011
@@ -168,11 +168,8 @@ static void
 clear_xstr_array(char *v[], int vsize)
 {
   if (v && vsize > 0) {
-    for (int i = 0; i < vsize; i++) {
-      if (v[i]) {
-        v[i] = (char *) xfree_null(v[i]);
-      }
-    }
+    for (int i = 0; i < vsize; i++)
+      v[i] = (char *)ats_free_null(v[i]);
   }
 }
 
@@ -1479,8 +1476,7 @@ UrlRewrite::BuildTable()
       goto MAP_ERROR;
     }
 
-    if (unlikely(fromHost_lower_ptr))
-      fromHost_lower_ptr = (char *) xfree_null(fromHost_lower_ptr);
+    fromHost_lower_ptr = (char *)ats_free_null(fromHost_lower_ptr);
 
     cur_line = tokLine(NULL, &tok_state);
     ++cln;



Mime
View raw message