trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1165975 - in /trafficserver/traffic/trunk: iocore/cache/ iocore/dns/ iocore/eventsystem/ iocore/hostdb/ iocore/net/ proxy/ proxy/http/ proxy/http/remap/ proxy/logging/
Date Wed, 07 Sep 2011 02:53:22 GMT
Author: zwoop
Date: Wed Sep  7 02:53:21 2011
New Revision: 1165975

URL: http://svn.apache.org/viewvc?rev=1165975&view=rev
Log:
TS-567 Second set of xmalloc -> ats_malloc conversion

Modified:
    trafficserver/traffic/trunk/iocore/cache/Cache.cc
    trafficserver/traffic/trunk/iocore/cache/CacheHosting.cc
    trafficserver/traffic/trunk/iocore/cache/CacheVol.cc
    trafficserver/traffic/trunk/iocore/dns/SplitDNS.cc
    trafficserver/traffic/trunk/iocore/eventsystem/Thread.cc
    trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc
    trafficserver/traffic/trunk/iocore/net/SSLNet.cc
    trafficserver/traffic/trunk/iocore/net/Socks.cc
    trafficserver/traffic/trunk/proxy/CacheControl.cc
    trafficserver/traffic/trunk/proxy/Main.cc
    trafficserver/traffic/trunk/proxy/ParentSelection.cc
    trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
    trafficserver/traffic/trunk/proxy/http/HttpSM.cc
    trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
    trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc
    trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc
    trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc
    trafficserver/traffic/trunk/proxy/logging/LogHost.cc
    trafficserver/traffic/trunk/proxy/logging/LogObject.cc

Modified: trafficserver/traffic/trunk/iocore/cache/Cache.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/Cache.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/Cache.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/Cache.cc Wed Sep  7 02:53:21 2011
@@ -521,7 +521,7 @@ CacheProcessor::start_internal(int flags
   /* read the config file and create the data structures corresponding
      to the file */
   gndisks = theCacheStore.n_disks;
-  gdisks = (CacheDisk **) xmalloc(gndisks * sizeof(CacheDisk *));
+  gdisks = (CacheDisk **)ats_malloc(gndisks * sizeof(CacheDisk *));
 
   gndisks = 0;
   ink_aio_set_callback(new AIO_Callback_handler());
@@ -615,7 +615,7 @@ CacheProcessor::diskInitialized()
       // create a new array
       CacheDisk **p_good_disks;
       if ((gndisks - bad_disks) > 0)
-        p_good_disks = (CacheDisk **) xmalloc((gndisks - bad_disks) * sizeof(CacheDisk *));
+        p_good_disks = (CacheDisk **)ats_malloc((gndisks - bad_disks) * sizeof(CacheDisk
*));
       else
         p_good_disks = 0;
 
@@ -662,7 +662,7 @@ CacheProcessor::diskInitialized()
       }
     }
 
-    gvol = (Vol **) xmalloc(gnvol * sizeof(Vol *));
+    gvol = (Vol **)ats_malloc(gnvol * sizeof(Vol *));
     memset(gvol, 0, gnvol * sizeof(Vol *));
     gnvol = 0;
     for (i = 0; i < gndisks; i++) {
@@ -1550,8 +1550,8 @@ void
 build_vol_hash_table(CacheHostRecord *cp)
 {
   int num_vols = cp->num_vols;
-  unsigned int *mapping = (unsigned int *) xmalloc(sizeof(unsigned int) * num_vols);
-  Vol **p = (Vol **) xmalloc(sizeof(Vol *) * num_vols);
+  unsigned int *mapping = (unsigned int *)ats_malloc(sizeof(unsigned int) * num_vols);
+  Vol **p = (Vol **)ats_malloc(sizeof(Vol *) * num_vols);
 
   memset(mapping, 0, num_vols * sizeof(unsigned int));
   memset(p, 0, num_vols * sizeof(Vol *));
@@ -1587,7 +1587,7 @@ build_vol_hash_table(CacheHostRecord *cp
 
   unsigned int *forvol = (unsigned int *) alloca(sizeof(unsigned int) * num_vols);
   unsigned int *rnd = (unsigned int *) alloca(sizeof(unsigned int) * num_vols);
-  unsigned short *ttable = (unsigned short *) xmalloc(sizeof(unsigned short) * VOL_HASH_TABLE_SIZE);
+  unsigned short *ttable = (unsigned short *)ats_malloc(sizeof(unsigned short) * VOL_HASH_TABLE_SIZE);
 
   for (i = 0; i < num_vols; i++) {
     forvol[i] = (VOL_HASH_TABLE_SIZE * (p[i]->len >> STORE_BLOCK_SHIFT)) / total;
@@ -1775,7 +1775,7 @@ Cache::open(bool clear, bool fix)
   CacheVol *cp = cp_list.head;
   for (; cp; cp = cp->link.next) {
     if (cp->scheme == scheme) {
-      cp->vols = (Vol **) xmalloc(cp->num_vols * sizeof(Vol *));
+      cp->vols = (Vol **)ats_malloc(cp->num_vols * sizeof(Vol *));
       int vol_no = 0;
       for (i = 0; i < gndisks; i++) {
         if (cp->disk_vols[i] && !DISK_BAD(cp->disk_vols[i]->disk)) {
@@ -2203,7 +2203,7 @@ cplist_init()
         new_p->num_vols = dp[j]->num_volblocks;
         new_p->size = dp[j]->size;
         new_p->scheme = dp[j]->dpb_queue.head->b->type;
-        new_p->disk_vols = (DiskVol **) xmalloc(gndisks * sizeof(DiskVol *));
+        new_p->disk_vols = (DiskVol **)ats_malloc(gndisks * sizeof(DiskVol *));
         memset(new_p->disk_vols, 0, gndisks * sizeof(DiskVol *));
         new_p->disk_vols[i] = dp[j];
         cp_list.enqueue(new_p);
@@ -2272,7 +2272,7 @@ cplist_reconfigure()
     CacheVol *cp = NEW(new CacheVol());
     cp->vol_number = 0;
     cp->scheme = CACHE_HTTP_TYPE;
-    cp->disk_vols = (DiskVol **) xmalloc(gndisks * sizeof(DiskVol *));
+    cp->disk_vols = (DiskVol **)ats_malloc(gndisks * sizeof(DiskVol *));
     memset(cp->disk_vols, 0, gndisks * sizeof(DiskVol *));
     cp_list.enqueue(cp);
     cp_list_len++;
@@ -2365,7 +2365,7 @@ cplist_reconfigure()
         // we did not find a corresponding entry in cache vol...creat one
 
         CacheVol *new_cp = NEW(new CacheVol());
-        new_cp->disk_vols = (DiskVol **) xmalloc(gndisks * sizeof(DiskVol *));
+        new_cp->disk_vols = (DiskVol **)ats_malloc(gndisks * sizeof(DiskVol *));
         memset(new_cp->disk_vols, 0, gndisks * sizeof(DiskVol *));
         if (create_volume(config_vol->number, size_in_blocks, config_vol->scheme, new_cp))
           return -1;

Modified: trafficserver/traffic/trunk/iocore/cache/CacheHosting.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheHosting.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheHosting.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheHosting.cc Wed Sep  7 02:53:21 2011
@@ -121,7 +121,7 @@ CacheHostMatcher::Match(char *rdata, int
 
   if (rlen == 0)
     return;
-  char *data = (char *) xmalloc(rlen + 1);
+  char *data = (char *)ats_malloc(rlen + 1);
   memcpy(data, rdata, rlen);
   *(data + rlen) = '\0';
   HostLookupState s;
@@ -306,7 +306,7 @@ CacheHostTable::BuildTableFromString(cha
 
     if (*tmp != '#' && *tmp != '\0') {
 
-      current = (matcher_line *) xmalloc(sizeof(matcher_line));
+      current = (matcher_line *)ats_malloc(sizeof(matcher_line));
       errPtr = parseConfigLine((char *) tmp, current, config_tags);
 
       if (errPtr != NULL) {
@@ -453,7 +453,7 @@ CacheHostRecord::Init(int typ)
   err[0] = 0;
   num_vols = 0;
   type = typ;
-  cp = (CacheVol **) xmalloc(cp_list_len * sizeof(CacheVol *));
+  cp = (CacheVol **)ats_malloc(cp_list_len * sizeof(CacheVol *));
   memset(cp, 0, cp_list_len * sizeof(CacheVol *));
   num_cachevols = 0;
   CacheVol *cachep = cp_list.head;
@@ -470,7 +470,7 @@ CacheHostRecord::Init(int typ)
     IOCORE_SignalError(err, alarmAlready);
     return -1;
   }
-  vols = (Vol **) xmalloc(num_vols * sizeof(Vol *));
+  vols = (Vol **)ats_malloc(num_vols * sizeof(Vol *));
   int counter = 0;
   for (i = 0; i < num_cachevols; i++) {
     CacheVol *cachep1 = cp[i];
@@ -541,7 +541,7 @@ CacheHostRecord::Init(matcher_line * lin
       }
       s = val;
       num_cachevols++;
-      cp = (CacheVol **) xmalloc(num_cachevols * sizeof(CacheVol *));
+      cp = (CacheVol **)ats_malloc(num_cachevols * sizeof(CacheVol *));
       memset(cp, 0, num_cachevols * sizeof(CacheVol *));
       num_cachevols = 0;
       while (1) {
@@ -605,7 +605,7 @@ CacheHostRecord::Init(matcher_line * lin
   if (!num_vols) {
     return -1;
   }
-  vols = (Vol **) xmalloc(num_vols * sizeof(Vol *));
+  vols = (Vol **)ats_malloc(num_vols * sizeof(Vol *));
   int counter = 0;
   for (i = 0; i < num_cachevols; i++) {
     CacheVol *cachep = cp[i];

Modified: trafficserver/traffic/trunk/iocore/cache/CacheVol.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheVol.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheVol.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheVol.cc Wed Sep  7 02:53:21 2011
@@ -123,8 +123,8 @@ static char *make_vol_map(Vol *d)
   off_t start_offset = vol_offset_to_offset(d, 0);
   off_t vol_len = vol_relative_length(d, start_offset);
   size_t map_len = (vol_len + (SCAN_BUF_SIZE - 1)) / SCAN_BUF_SIZE;
-  char *vol_map = (char *)xmalloc(map_len);
-  if (!vol_map) return NULL;
+  char *vol_map = (char *)ats_malloc(map_len);
+
   memset(vol_map, 0, map_len);
 
   // Scan directories.

Modified: trafficserver/traffic/trunk/iocore/dns/SplitDNS.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/dns/SplitDNS.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/dns/SplitDNS.cc (original)
+++ trafficserver/traffic/trunk/iocore/dns/SplitDNS.cc Wed Sep  7 02:53:21 2011
@@ -458,7 +458,7 @@ SplitDNSRecord::Init(matcher_line * line
 {
   const char *errPtr = NULL;
   const int errBufLen = 1024;
-  char *errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+  char *errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
   const char *tmp;
   char *label;
   char *val;

Modified: trafficserver/traffic/trunk/iocore/eventsystem/Thread.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/Thread.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/Thread.cc (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/Thread.cc Wed Sep  7 02:53:21 2011
@@ -93,7 +93,7 @@ spawn_thread_internal(void *a)
 void
 Thread::start(const char* name, ThreadFunction f, void *a, size_t stacksize)
 {
-  thread_data_internal *p = (thread_data_internal *) xmalloc(sizeof(thread_data_internal));
+  thread_data_internal *p = (thread_data_internal *)ats_malloc(sizeof(thread_data_internal));
 
   if (0 == stacksize)
     REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");

Modified: trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc (original)
+++ trafficserver/traffic/trunk/iocore/hostdb/MultiCache.cc Wed Sep  7 02:53:21 2011
@@ -1246,9 +1246,8 @@ MultiCacheHeapGC(Continuation *acont, Mu
   Continuation(amc->locks[0]), cont(acont), mc(amc), partition(0), n_offsets(0) {
 
     SET_HANDLER((MCacheHeapGCHandler) & MultiCacheHeapGC::startEvent);
-    offset_table = (OffsetTable *)
-      xmalloc(sizeof(OffsetTable) *
-              ((mc->totalelements / MULTI_CACHE_PARTITIONS) + mc->elements[mc->levels
- 1] * 3 + 1));
+    offset_table = (OffsetTable *)ats_malloc(sizeof(OffsetTable) *
+        ((mc->totalelements / MULTI_CACHE_PARTITIONS) + mc->elements[mc->levels
- 1] * 3 + 1));
     // flip halfspaces
     mutex = mc->locks[partition];
     mc->heap_halfspace = mc->heap_halfspace ? 0 : 1;
@@ -1312,7 +1311,7 @@ UnsunkPtrRegistry::alloc_data()
 {
   int bs = MULTI_CACHE_UNSUNK_PTR_BLOCK_SIZE(mc->totalelements);
   size_t s = bs * sizeof(UnsunkPtr);
-  ptrs = (UnsunkPtr *) xmalloc(s);
+  ptrs = (UnsunkPtr *)ats_malloc(s);
   for (int i = 0; i < bs; i++) {
     ptrs[i].offset = 0;
     ptrs[i].poffset = (int *) &ptrs[i + 1];

Modified: trafficserver/traffic/trunk/iocore/net/SSLNet.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/SSLNet.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/SSLNet.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/SSLNet.cc Wed Sep  7 02:53:21 2011
@@ -362,7 +362,7 @@ SSLNetProcessor::initSSLServerCTX(SslCon
     }
   } else {
     const size_t completeServerCertPathSize = strlen(param->getServerCertPathOnly()) +
strlen(serverCertPtr) + 1;
-    completeServerCertPath = (char *) xmalloc(completeServerCertPathSize);
+    completeServerCertPath = (char *)ats_malloc(completeServerCertPathSize);
 
     ink_strncpy(completeServerCertPath, (const char *) param->getServerCertPathOnly(),
completeServerCertPathSize);
     ink_strlcat(completeServerCertPath, serverCertPtr, completeServerCertPathSize);

Modified: trafficserver/traffic/trunk/iocore/net/Socks.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/Socks.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/Socks.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/Socks.cc Wed Sep  7 02:53:21 2011
@@ -586,7 +586,7 @@ loadSocksAuthInfo(int fd, socks_conf_str
 
       socks_stuff->user_name_n_passwd_len = len1 + len2 + 2;
 
-      char *ptr = (char *) xmalloc(socks_stuff->user_name_n_passwd_len);
+      char *ptr = (char *)ats_malloc(socks_stuff->user_name_n_passwd_len);
       ptr[0] = len1;
       memcpy(&ptr[1], user_name, len1);
       ptr[len1 + 1] = len2;

Modified: trafficserver/traffic/trunk/proxy/CacheControl.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/CacheControl.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/CacheControl.cc (original)
+++ trafficserver/traffic/trunk/proxy/CacheControl.cc Wed Sep  7 02:53:21 2011
@@ -283,7 +283,7 @@ CacheControlRecord::Init(matcher_line * 
       char* ptr = 0;
       int v = strtol(val, &ptr, 0);
       if (!ptr || v < 0 || v > 4) {
-        errBuf = static_cast<char*>(xmalloc(errBufLen * sizeof(char)));
+        errBuf = static_cast<char*>(ats_malloc(errBufLen * sizeof(char)));
         snprintf(errBuf, errBufLen,
           "Value for " TWEAK_CACHE_RESPONSES_TO_COOKIES
           " must be an integer in the range 0..4"
@@ -331,7 +331,7 @@ CacheControlRecord::Init(matcher_line * 
        // directive = CC_CACHE_AUTH_CONTENT;
        // d_found = true;
       } else {
-        errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+        errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
         snprintf(errBuf, errBufLen, "%s Invalid action at line %d in cache.config", modulePrefix,
line_num);
         return errBuf;
       }
@@ -354,7 +354,7 @@ CacheControlRecord::Init(matcher_line * 
           this->time_arg = time_in;
 
         } else {
-          errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+          errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
           snprintf(errBuf, errBufLen, "%s %s at line %d in cache.config", modulePrefix, tmp,
line_num);
           return errBuf;
         }
@@ -370,7 +370,7 @@ CacheControlRecord::Init(matcher_line * 
   }
 
   if (d_found == false) {
-    errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+    errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
     snprintf(errBuf, errBufLen, "%s No directive in cache.config at line %d", modulePrefix,
line_num);
     return errBuf;
   }
@@ -379,7 +379,7 @@ CacheControlRecord::Init(matcher_line * 
     tmp = ProcessModifiers(line_info);
 
     if (tmp != NULL) {
-      errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+      errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
       snprintf(errBuf, errBufLen, "%s %s at line %d in cache.config", modulePrefix, tmp,
line_num);
       return errBuf;
     }

Modified: trafficserver/traffic/trunk/proxy/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Main.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Main.cc (original)
+++ trafficserver/traffic/trunk/proxy/Main.cc Wed Sep  7 02:53:21 2011
@@ -1417,7 +1417,7 @@ change_uid_gid(const char *user)
     ink_fatal_die("sysconf() failed for _SC_GETPW_R_SIZE_MAX");
   }
 
-  char *buf = (char *)xmalloc(buflen);
+  char *buf = (char *)ats_malloc(buflen);
 
   if (0 != geteuid() && 0 == getuid()) seteuid(0); // revert euid if possible.
   if (0 != geteuid()) {
@@ -1566,7 +1566,8 @@ main(int argc, char **argv)
     TS_ReadConfigInteger(num_task_threads, "proxy.config.task_threads");
 
   const long max_login =  sysconf(_SC_LOGIN_NAME_MAX) <= 0 ? _POSIX_LOGIN_NAME_MAX : 
sysconf(_SC_LOGIN_NAME_MAX);
-  char *user = (char *)xmalloc(max_login);
+  char *user = (char *)ats_malloc(max_login);
+
   *user = '\0';
   admin_user_p = 
     (REC_ERR_OKAY ==

Modified: trafficserver/traffic/trunk/proxy/ParentSelection.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/ParentSelection.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/ParentSelection.cc (original)
+++ trafficserver/traffic/trunk/proxy/ParentSelection.cc Wed Sep  7 02:53:21 2011
@@ -628,7 +628,7 @@ ParentRecord::ProcessParents(char *val)
     return "No parents specified";
   }
   // Allocate the parents array
-  this->parents = (pRecord *) xmalloc(sizeof(pRecord) * numTok);
+  this->parents = (pRecord *)ats_malloc(sizeof(pRecord) * numTok);
 
   // Loop through the set of parents specified
   //
@@ -708,7 +708,7 @@ ParentRecord::DefaultInit(char *val)
   errPtr = ProcessParents(val);
 
   if (errPtr != NULL) {
-    errBuf = (char *) xmalloc(1024);
+    errBuf = (char *)ats_malloc(1024);
     snprintf(errBuf, 1024, "%s %s for default parent proxy", modulePrefix, errPtr);
     SignalError(errBuf, alarmAlready);
     xfree(errBuf);
@@ -778,7 +778,7 @@ ParentRecord::Init(matcher_line * line_i
     }
     // Report errors generated by ProcessParents();
     if (errPtr != NULL) {
-      errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+      errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
       snprintf(errBuf, errBufLen, "%s %s at line %d", modulePrefix, errPtr, line_num);
       return errBuf;
     }
@@ -791,7 +791,7 @@ ParentRecord::Init(matcher_line * line_i
   }
 
   if (this->parents == NULL && go_direct == false) {
-    errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+    errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
     snprintf(errBuf, errBufLen, "%s No parent specified in parent.config at line %d", modulePrefix,
line_num);
     return errBuf;
   }
@@ -800,7 +800,7 @@ ParentRecord::Init(matcher_line * line_i
     tmp = ProcessModifiers(line_info);
 
     if (tmp != NULL) {
-      errBuf = (char *) xmalloc(errBufLen * sizeof(char));
+      errBuf = (char *)ats_malloc(errBufLen * sizeof(char));
       snprintf(errBuf, errBufLen, "%s %s at line %d in parent.config", modulePrefix, tmp,
line_num);
       return errBuf;
     }

Modified: trafficserver/traffic/trunk/proxy/http/HttpConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpConfig.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpConfig.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpConfig.cc Wed Sep  7 02:53:21 2011
@@ -1127,7 +1127,7 @@ HttpConfig::startup()
   c.proxy_hostname_len = -1;
 
   if (c.proxy_hostname == NULL) {
-    c.proxy_hostname = (char *) xmalloc(sizeof(char));
+    c.proxy_hostname = (char *)ats_malloc(sizeof(char));
     c.proxy_hostname[0] = '\0';
   }
 
@@ -1979,7 +1979,7 @@ HttpConfig::parse_url_expansions(char *u
 
   // Now extract the URL expansions
   if (count) {
-    expansions = (char **) xmalloc(count * sizeof(char *));
+    expansions = (char **)ats_malloc(count * sizeof(char *));
     start = url_expansions_str;
     for (i = 0; i < count; i++) {
       // Skip whitespace

Modified: trafficserver/traffic/trunk/proxy/http/HttpSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpSM.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpSM.cc Wed Sep  7 02:53:21 2011
@@ -2158,7 +2158,7 @@ HttpSM::state_handle_stat_page(int event
       if (spd->type)
         t_state.internal_msg_buffer_type = spd->type;
       else {
-        t_state.internal_msg_buffer_type = (char *) xmalloc(10);
+        t_state.internal_msg_buffer_type = (char *)ats_malloc(10);
         snprintf(t_state.internal_msg_buffer_type, 10, "text/html");
       }
       t_state.internal_msg_buffer_size = spd->length;
@@ -6289,7 +6289,7 @@ HttpSM::dump_state_hdr(HTTPHdr *h, const
   // Dump the client request if available
   if (h->valid()) {
     int l = h->length_get();
-    char *hdr_buf = (char *) xmalloc(l + 1);
+    char *hdr_buf = (char *)ats_malloc(l + 1);
     int index = 0;
     int offset = 0;
 
@@ -6928,7 +6928,7 @@ HttpSM::redirect_request(const char *red
 #if defined(__GNUC__)
       char buf[host_len + 7];
 #else
-      char *buf = (char *)xmalloc(host_len + 7);
+      char *buf = (char *)ats_malloc(host_len + 7);
 #endif
       strncpy(buf, host, host_len);
       host_len += snprintf(buf + host_len, sizeof(buf) - host_len, ":%d", port);

Modified: trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransact.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransact.cc Wed Sep  7 02:53:21 2011
@@ -524,7 +524,7 @@ how_to_open_connection(HttpTransact::Sta
         // to the default port.
         int port = url->port_get();
         if (port != url_canonicalize_port(URL_TYPE_HTTP, 0)) {
-          char *buf = (char *) xmalloc(host_len + 15);
+          char *buf = (char *)ats_malloc(host_len + 15);
           strncpy(buf, host, host_len);
           host_len += snprintf(buf + host_len, host_len + 15, ":%d", port);
           s->hdr_info.server_request.value_set(MIME_FIELD_HOST, MIME_LEN_HOST, buf, host_len);
@@ -1043,7 +1043,7 @@ HttpTransact::ModifyRequest(State* s)
     char *buf = NULL;
 
     if (port > 0) {
-      buf = (char *) xmalloc(host_val_len + 15);
+      buf = (char *)ats_malloc(host_val_len + 15);
       strncpy(buf, hostname, host_val_len);
       host_val_len += snprintf(buf + host_val_len, host_val_len + 15, ":%d", port);
       host_val = (const char**)(&buf);
@@ -5490,7 +5490,7 @@ HttpTransact::handle_trace_and_options_r
         s->internal_msg_buffer = (char *) ioBufAllocator[s->internal_msg_buffer_fast_allocator_size].alloc_void();
       } else {
         s->internal_msg_buffer_fast_allocator_size = -1;
-        s->internal_msg_buffer = (char *) xmalloc(s->internal_msg_buffer_size);
+        s->internal_msg_buffer = (char *)ats_malloc(s->internal_msg_buffer_size);
       }
 
       // clear the stupid buffer
@@ -7811,7 +7811,7 @@ HttpTransact::build_request(State* s, HT
     // to the default port.
     int port = url->port_get();
     if (port != url_canonicalize_port(URL_TYPE_HTTP, 0)) {
-      char *buf = (char *) xmalloc(host_len + 15);
+      char *buf = (char *) ats_malloc(host_len + 15);
       strncpy(buf, host, host_len);
       host_len += snprintf(buf + host_len, host_len + 15, ":%d", port);
       outgoing_request->value_set(MIME_FIELD_HOST, MIME_LEN_HOST, buf, host_len);

Modified: trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransactHeaders.cc Wed Sep  7 02:53:21 2011
@@ -134,7 +134,7 @@ HttpTransactHeaders::insert_supported_me
     alloced_buffer = NULL;
     value_buffer = inline_buffer;
   } else {
-    alloced_buffer = (char *) xmalloc(bytes);
+    alloced_buffer = (char *)ats_malloc(bytes);
     value_buffer = alloced_buffer;
   }
 

Modified: trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc Wed Sep  7 02:53:21 2011
@@ -179,7 +179,7 @@ RemapPlugins::run_single_remap()
     unsigned int newPathLenNeed = (requestPathLen - fromPathLen) + toPathLen + 8; // 3 +
some padding
 
     if (newPathLenNeed > sizeof(newPathTmp)) {
-      newPath = (newPathAlloc = (char *) xmalloc(newPathLenNeed));
+      newPath = (newPathAlloc = (char *)ats_malloc(newPathLenNeed));
       if (debug_on) {
         memset(newPath, 0, newPathLenNeed);
       }

Modified: trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogCollationClientSM.cc Wed Sep  7 02:53:21
2011
@@ -316,7 +316,7 @@ LogCollationClientSM::client_dns(int eve
     }
     // careful!!! could have problems later!!!
     m_log_host->m_ip = ink_inet_ip4_addr_cast(hostdb_info->ip());
-    m_log_host->m_ipstr = (char *) xmalloc(INET6_ADDRSTRLEN);
+    m_log_host->m_ipstr = (char *)ats_malloc(INET6_ADDRSTRLEN);
     ink_inet_ntop(hostdb_info->ip(), m_log_host->m_ipstr, INET6_ADDRSTRLEN);
 
     return client_open(LOG_COLL_EVENT_SWITCH, NULL);
@@ -531,7 +531,7 @@ LogCollationClientSM::client_init(int ev
       ink_gethostbyname_r_data data;
       struct hostent *ent = ink_gethostbyname_r(m_log_host->m_name, &data);
       m_log_host->m_ip = *(unsigned int *) ent->h_addr_list[0];
-      m_log_host->m_ipstr = (char *) xmalloc(32);
+      m_log_host->m_ipstr = (char *)ats_malloc(32);
       LogUtils::ip_to_str(m_log_host->m_ip, m_log_host->m_ipstr, 32);
       return client_open(LOG_COLL_EVENT_SWITCH, NULL);
 #endif

Modified: trafficserver/traffic/trunk/proxy/logging/LogHost.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogHost.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogHost.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogHost.cc Wed Sep  7 02:53:21 2011
@@ -115,7 +115,7 @@ LogHost::set_name_port(char *hostname, u
   m_ip = 0;                     // make sure ip is 0 for iocore
 #if !defined(IOCORE_LOG_COLLATION)
   m_ip = LogUtils::ip_from_host(hostname);
-  m_ipstr = (char *) xmalloc(32);
+  m_ipstr = (char *)ats_malloc(32);
   LogUtils::ip_to_str(m_ip, m_ipstr, 32);
 #endif
   m_name = xstrdup(hostname);
@@ -237,8 +237,8 @@ LogHost::create_orphan_LogFile_object()
 
   const char *orphan_ext = "orphan";
   unsigned name_len = (unsigned) (strlen(m_object_filename) + strlen(name()) + strlen(orphan_ext)
+ 16);
-  char *name_buf = (char *) xmalloc(name_len);
-  ink_assert(name_buf != NULL);
+  char *name_buf = (char *)ats_malloc(name_len);
+
   // NT: replace ':'s with '-'s.  This change is necessary because
   // NT doesn't like filenames with ':'s in them.  ^_^
   snprintf(name_buf, name_len, "%s%s%s-%u.%s",

Modified: trafficserver/traffic/trunk/proxy/logging/LogObject.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogObject.cc?rev=1165975&r1=1165974&r2=1165975&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogObject.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogObject.cc Wed Sep  7 02:53:21 2011
@@ -249,8 +249,8 @@ LogObject::generate_filenames(const char
   int basename_len = len + ext_len + 1; // include null terminator
   int total_len = dir_len + 1 + basename_len;   // include '/'
 
-  m_filename = (char *) xmalloc(total_len);
-  m_basename = (char *) xmalloc(basename_len);
+  m_filename = (char *)ats_malloc(total_len);
+  m_basename = (char *)ats_malloc(basename_len);
 
   memcpy(m_filename, log_dir, dir_len);
   m_filename[dir_len++] = '/';
@@ -333,7 +333,7 @@ uint64_t LogObject::compute_signature(Lo
 
   if (fl && ps && filename) {
     int buf_size = strlen(fl) + strlen(ps) + strlen(filename) + 2;
-    char *buffer = (char *) xmalloc(buf_size);
+    char *buffer = (char *)ats_malloc(buf_size);
 
     ink_string_concatenate_strings(buffer, fl, ps, filename, flags & LogObject::BINARY
? "B" :
                                    (flags & LogObject::WRITES_TO_PIPE ? "P" : "A"), NULL);



Mime
View raw message