trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1166278 - in /trafficserver/traffic/trunk: iocore/cache/ mgmt/api/ mgmt/api/include/ mgmt/preparse/ mgmt/web2/
Date Wed, 07 Sep 2011 17:28:03 GMT
Author: zwoop
Date: Wed Sep  7 17:28:02 2011
New Revision: 1166278

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

Modified:
    trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc
    trafficserver/traffic/trunk/iocore/cache/RamCacheLRU.cc
    trafficserver/traffic/trunk/iocore/cache/Store.cc
    trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc
    trafficserver/traffic/trunk/mgmt/api/GenericParser.cc
    trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc
    trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc
    trafficserver/traffic/trunk/mgmt/api/include/mgmtapi.h
    trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc
    trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc
    trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc

Modified: trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/RamCacheCLFUS.cc Wed Sep  7 17:28:02 2011
@@ -111,7 +111,7 @@ void RamCacheCLFUS::resize_hashtable() {
   int anbuckets = bucket_sizes[ibuckets];
   DDebug("ram_cache", "resize hashtable %d", anbuckets);
   int64_t s = anbuckets * sizeof(DList(RamCacheCLFUSEntry, hash_link));
-  DList(RamCacheCLFUSEntry, hash_link) *new_bucket = (DList(RamCacheCLFUSEntry, hash_link)
*)xmalloc(s);
+  DList(RamCacheCLFUSEntry, hash_link) *new_bucket = (DList(RamCacheCLFUSEntry, hash_link)
*)ats_malloc(s);
   memset(new_bucket, 0, s);
   if (bucket) {
     for (int64_t i = 0; i < nbuckets; i++) {
@@ -125,7 +125,7 @@ void RamCacheCLFUS::resize_hashtable() {
   nbuckets = anbuckets;
   if (seen) xfree(seen);
   int size = bucket_sizes[ibuckets] * sizeof(uint16_t);
-  seen = (uint16_t*)xmalloc(size);
+  seen = (uint16_t*)ats_malloc(size);
   memset(seen, 0, size);
 }
 
@@ -167,7 +167,7 @@ int RamCacheCLFUS::get(INK_MD5 *key, Ptr
       if (!e->flag_bits.lru) { // in memory
         e->hits++;
         if (e->flag_bits.compressed) {
-          b = (char*)xmalloc(e->len);
+          b = (char*)ats_malloc(e->len);
           switch (e->flag_bits.compressed) {
             default: goto Lfailed;
             case CACHE_COMPRESSION_FASTLZ: {
@@ -335,7 +335,7 @@ void RamCacheCLFUS::compress_entries(ETh
       uint32_t elen = e->len;
       INK_MD5 key = e->key;
       MUTEX_UNTAKE_LOCK(vol->mutex, thread);
-      b = (char*)xmalloc(l);
+      b = (char*)ats_malloc(l);
       bool failed = false;
       switch (ctype) {
         default: goto Lfailed;
@@ -386,7 +386,7 @@ void RamCacheCLFUS::compress_entries(ETh
         goto Lfailed;
       if (l < e->len) {
         e->flag_bits.compressed = cache_config_ram_cache_compress;
-        bb = (char*)xmalloc(l);
+        bb = (char*)ats_malloc(l);
         memcpy(bb, b, l);
         xfree(b);
         e->compressed_len = l;
@@ -397,7 +397,7 @@ void RamCacheCLFUS::compress_entries(ETh
       } else {
         xfree(b);
         e->flag_bits.compressed = 0;
-        bb = (char*)xmalloc(e->len);
+        bb = (char*)ats_malloc(e->len);
         memcpy(bb, e->data->data(), e->len);
         int64_t delta = ((int64_t)e->len) - (int64_t)e->size;
         bytes += delta;
@@ -467,7 +467,7 @@ int RamCacheCLFUS::put(INK_MD5 *key, IOB
         e->size = size;
         e->data = data;
       } else {
-        char *b = (char*)xmalloc(len);
+        char *b = (char*)ats_malloc(len);
         memcpy(b, data->data(), len);
         e->data = new_xmalloc_IOBufferData(b, len);
         e->data->_mem_type = DEFAULT_ALLOC;
@@ -560,7 +560,7 @@ Linsert:
   if (!copy)
     e->data = data;
   else {
-    char *b = (char*)xmalloc(len);
+    char *b = (char*)ats_malloc(len);
     memcpy(b, data->data(), len);
     e->data = new_xmalloc_IOBufferData(b, len);
     e->data->_mem_type = DEFAULT_ALLOC;

Modified: trafficserver/traffic/trunk/iocore/cache/RamCacheLRU.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/RamCacheLRU.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/RamCacheLRU.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/RamCacheLRU.cc Wed Sep  7 17:28:02 2011
@@ -70,7 +70,7 @@ void RamCacheLRU::resize_hashtable() {
   int anbuckets = bucket_sizes[ibuckets];
   DDebug("ram_cache", "resize hashtable %d", anbuckets);
   int64_t s = anbuckets * sizeof(DList(RamCacheLRUEntry, hash_link));
-  DList(RamCacheLRUEntry, hash_link) *new_bucket = (DList(RamCacheLRUEntry, hash_link) *)xmalloc(s);
+  DList(RamCacheLRUEntry, hash_link) *new_bucket = (DList(RamCacheLRUEntry, hash_link) *)ats_malloc(s);
   memset(new_bucket, 0, s);
   if (bucket) {
     for (int64_t i = 0; i < nbuckets; i++) {
@@ -84,7 +84,7 @@ void RamCacheLRU::resize_hashtable() {
   nbuckets = anbuckets;
   if (seen) xfree(seen);
   int size = bucket_sizes[ibuckets] * sizeof(uint16_t);
-  seen = (uint16_t*)xmalloc(size);
+  seen = (uint16_t*)ats_malloc(size);
   memset(seen, 0, size);
 }
 

Modified: trafficserver/traffic/trunk/iocore/cache/Store.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/Store.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/Store.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/Store.cc Wed Sep  7 17:28:02 2011
@@ -1080,7 +1080,7 @@ Store::read(int fd, char *aname)
   if (sscanf(buf, "%d\n", &n_disks) != 1)
     return (-1);
 
-  disk = (Span **) xmalloc(sizeof(Span *) * n_disks);
+  disk = (Span **)ats_malloc(sizeof(Span *) * n_disks);
   if (!disk)
     return -1;
   memset(disk, 0, sizeof(Span *) * n_disks);
@@ -1132,7 +1132,7 @@ void
 Store::dup(Store & s)
 {
   s.n_disks = n_disks;
-  s.disk = (Span **) xmalloc(sizeof(Span *) * n_disks);
+  s.disk = (Span **)ats_malloc(sizeof(Span *) * n_disks);
   for (int i = 0; i < n_disks; i++)
     s.disk[i] = disk[i]->dup();
 }

Modified: trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc Wed Sep  7 17:28:02 2011
@@ -1889,7 +1889,7 @@ chopWhiteSpaces_alloc(char *str)
 
   // eliminate trailing white spaces
   len = strcspn(str, " ");
-  newStr = (char *) xmalloc(len + 1);
+  newStr = (char *)ats_malloc(len + 1);
   memset(newStr, 0, len + 1);
   strncpy(newStr, str, len);
 
@@ -2450,7 +2450,7 @@ copy_int_list(TSIntList list)
   count = TSIntListLen(list);
   for (i = 0; i < count; i++) {
     elem = TSIntListDequeue(list);
-    nelem = (int *) xmalloc(sizeof(int));
+    nelem = (int *)ats_malloc(sizeof(int));
     *nelem = *elem;
     TSIntListEnqueue(list, elem);
     TSIntListEnqueue(nlist, nelem);
@@ -2862,7 +2862,7 @@ comment_ele_create(char *comment)
 {
   INKCommentEle *ele;
 
-  ele = (INKCommentEle *) xmalloc(sizeof(INKCommentEle));
+  ele = (INKCommentEle *)ats_malloc(sizeof(INKCommentEle));
 
   ele->cfg_ele.type = TS_TYPE_COMMENT;
   ele->cfg_ele.error = TS_ERR_OKAY;

Modified: trafficserver/traffic/trunk/mgmt/api/GenericParser.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/GenericParser.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/GenericParser.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/GenericParser.cc Wed Sep  7 17:28:02 2011
@@ -65,7 +65,7 @@ Token::setValue(const char *str)
   ink_assert(value == NULL);
   if (str_copy) {
     size_t len = strlen(str_copy);
-    value = (char *) xmalloc(sizeof(char) * (BUFSIZ));
+    value = (char *)ats_malloc(sizeof(char) * (BUFSIZ));
     len = (len < BUFSIZ) ? len : BUFSIZ - 1;
     memcpy(value, str_copy, len);
     value[len] = '\0';
@@ -1023,14 +1023,12 @@ RuleList::parse(char *fileBuf, TSFileNam
         rule->tokenList = m_tokenList;
       } else {
         //rule->setComment("## WARNING: The following configuration rule is invalid!");
-        char *error_rule;
         size_t error_rule_size = sizeof(char) * (strlen(line) + strlen("#ERROR: ") + 1);
-        error_rule = (char *) xmalloc(error_rule_size);
-        if (error_rule) {
-          snprintf(error_rule, error_rule_size, "#ERROR: %s", line);
-          rule->setComment(error_rule);
-          xfree(error_rule);
-        }
+        char *error_rule = (char *)ats_malloc(error_rule_size);
+
+        snprintf(error_rule, error_rule_size, "#ERROR: %s", line);
+        rule->setComment(error_rule);
+        xfree(error_rule);
       }
     }
 

Modified: trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/INKMgmtAPI.cc Wed Sep  7 17:28:02 2011
@@ -53,7 +53,7 @@ void *
 _TSmalloc(unsigned int size, const char *path)
 {
 #ifdef PURIFY
-  return xmalloc(size);
+  return ats_malloc(size);
 #else
   return _xmalloc(size, path);
 #endif
@@ -712,10 +712,7 @@ init_pdss_format(TSPdSsFormat * info)
 tsapi TSEvent *
 TSEventCreate(void)
 {
-  TSEvent *event;
-  event = (TSEvent *) xmalloc(sizeof(TSEvent));
-  if (!event)
-    return NULL;
+  TSEvent *event = (TSEvent *)ats_malloc(sizeof(TSEvent));
 
   event->id = -1;
   event->name = NULL;
@@ -741,11 +738,7 @@ TSEventDestroy(TSEvent * event)
 tsapi TSRecordEle *
 TSRecordEleCreate(void)
 {
-  TSRecordEle *ele;
-
-  ele = (TSRecordEle *) xmalloc(sizeof(TSRecordEle));
-  if (!ele)
-    return NULL;
+  TSRecordEle *ele = (TSRecordEle *)ats_malloc(sizeof(TSRecordEle));
 
   ele->rec_name = NULL;
   ele->rec_type = TS_REC_UNDEFINED;
@@ -769,11 +762,7 @@ TSRecordEleDestroy(TSRecordEle * ele)
 tsapi TSIpAddrEle *
 TSIpAddrEleCreate(void)
 {
-  TSIpAddrEle *ele;
-
-  ele = (TSIpAddrEle *) xmalloc(sizeof(TSIpAddrEle));
-  if (!ele)
-    return NULL;
+  TSIpAddrEle *ele = (TSIpAddrEle *)ats_malloc(sizeof(TSIpAddrEle));
 
   /* set default values */
   ele->type = TS_IP_UNDEFINED;
@@ -803,11 +792,7 @@ TSIpAddrEleDestroy(TSIpAddrEle * ele)
 tsapi TSPortEle *
 TSPortEleCreate(void)
 {
-  TSPortEle *ele;
-
-  ele = (TSPortEle *) xmalloc(sizeof(TSPortEle));
-  if (!ele)
-    return NULL;
+  TSPortEle *ele = (TSPortEle *)ats_malloc(sizeof(TSPortEle));
 
   ele->port_a = TS_INVALID_PORT;
   ele->port_b = TS_INVALID_PORT;
@@ -826,11 +811,7 @@ TSPortEleDestroy(TSPortEle * ele)
 tsapi TSDomain *
 TSDomainCreate()
 {
-  TSDomain *ele;
-
-  ele = (TSDomain *) xmalloc(sizeof(TSDomain));
-  if (!ele)
-    return NULL;
+  TSDomain *ele = (TSDomain *)ats_malloc(sizeof(TSDomain));
 
   ele->domain_val = NULL;
   ele->port = TS_INVALID_PORT;
@@ -852,11 +833,7 @@ TSDomainDestroy(TSDomain * ele)
 tsapi TSSspec *
 TSSspecCreate(void)
 {
-  TSSspec *sec_spec;
-
-  sec_spec = (TSSspec *) xmalloc(sizeof(TSSspec));
-  if (!sec_spec)
-    return NULL;
+  TSSspec *sec_spec = (TSSspec *)ats_malloc(sizeof(TSSspec));
 
   /* set defaults */
   sec_spec->active = 0;
@@ -891,11 +868,7 @@ TSSspecDestroy(TSSspec * ele)
 tsapi TSPdSsFormat *
 TSPdSsFormatCreate(void)
 {
-  TSPdSsFormat *ele;
-
-  ele = (TSPdSsFormat *) xmalloc(sizeof(TSPdSsFormat));
-  if (!ele)
-    return NULL;
+  TSPdSsFormat *ele = (TSPdSsFormat *)ats_malloc(sizeof(TSPdSsFormat));
 
   /* should set default values here */
   ele->pd_type = TS_PD_UNDEFINED;
@@ -951,9 +924,7 @@ TSCacheEleCreate(TSRuleTypeT type)
       type != TS_CACHE_TTL_IN_CACHE && type != TS_CACHE_AUTH_CONTENT && type
!= TS_TYPE_UNDEFINED)
     return NULL;                // invalid type
 
-  ele = (TSCacheEle *) xmalloc(sizeof(TSCacheEle));
-  if (!ele)
-    return NULL;
+  ele = (TSCacheEle *)ats_malloc(sizeof(TSCacheEle));
 
   /* set defaults */
   ele->cfg_ele.type = type;
@@ -986,11 +957,7 @@ TSCacheEleDestroy(TSCacheEle * ele)
 tsapi TSCongestionEle *
 TSCongestionEleCreate()
 {
-  TSCongestionEle *ele;
-
-  ele = (TSCongestionEle *) xmalloc(sizeof(TSCongestionEle));
-  if (!ele)
-    return NULL;
+  TSCongestionEle *ele = (TSCongestionEle *)ats_malloc(sizeof(TSCongestionEle));
 
   /* set defaults */
   ele->cfg_ele.type = TS_CONGESTION;
@@ -1038,11 +1005,7 @@ TSCongestionEleDestroy(TSCongestionEle *
 tsapi TSHostingEle *
 TSHostingEleCreate()
 {
-  TSHostingEle *ele;
-
-  ele = (TSHostingEle *) xmalloc(sizeof(TSHostingEle));
-  if (!ele)
-    return NULL;
+  TSHostingEle *ele = (TSHostingEle *)ats_malloc(sizeof(TSHostingEle));
 
   ele->cfg_ele.type = TS_HOSTING;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1072,11 +1035,7 @@ TSHostingEleDestroy(TSHostingEle * ele)
 tsapi TSIcpEle *
 TSIcpEleCreate()
 {
-  TSIcpEle *ele;
-
-  ele = (TSIcpEle *) xmalloc(sizeof(TSIcpEle));
-  if (!ele)
-    return NULL;
+  TSIcpEle *ele = (TSIcpEle *)ats_malloc(sizeof(TSIcpEle));
 
   /* set defaults */
   ele->cfg_ele.type = TS_ICP;
@@ -1116,11 +1075,7 @@ tsapi TSIpAllowEle *
 TSIpAllowEleCreate()
 {
 
-  TSIpAllowEle *ele;
-
-  ele = (TSIpAllowEle *) xmalloc(sizeof(TSIpAllowEle));
-  if (!ele)
-    return NULL;
+  TSIpAllowEle *ele = (TSIpAllowEle *)ats_malloc(sizeof(TSIpAllowEle));
 
   ele->cfg_ele.type = TS_IP_ALLOW;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1149,11 +1104,7 @@ TSIpAllowEleDestroy(TSIpAllowEle * ele)
 tsapi TSLogFilterEle *
 TSLogFilterEleCreate()
 {
-  TSLogFilterEle *ele;
-
-  ele = (TSLogFilterEle *) xmalloc(sizeof(TSLogFilterEle));
-  if (!ele)
-    return NULL;
+  TSLogFilterEle *ele = (TSLogFilterEle *)ats_malloc(sizeof(TSLogFilterEle));
 
   ele->cfg_ele.type = TS_LOG_FILTER;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1187,11 +1138,7 @@ TSLogFilterEleDestroy(TSLogFilterEle * e
 tsapi TSLogFormatEle *
 TSLogFormatEleCreate()
 {
-  TSLogFormatEle *ele;
-
-  ele = (TSLogFormatEle *) xmalloc(sizeof(TSLogFormatEle));
-  if (!ele)
-    return NULL;
+  TSLogFormatEle *ele = (TSLogFormatEle *)ats_malloc(sizeof(TSLogFormatEle));
 
   ele->cfg_ele.type = TS_LOG_FORMAT;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1221,11 +1168,7 @@ TSLogFormatEleDestroy(TSLogFormatEle * e
 tsapi TSLogObjectEle *
 TSLogObjectEleCreate()
 {
-  TSLogObjectEle *ele;
-
-  ele = (TSLogObjectEle *) xmalloc(sizeof(TSLogObjectEle));
-  if (!ele)
-    return NULL;
+  TSLogObjectEle *ele = (TSLogObjectEle *)ats_malloc(sizeof(TSLogObjectEle));
 
   ele->cfg_ele.type = TS_LOG_OBJECT;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1272,9 +1215,7 @@ TSParentProxyEleCreate(TSRuleTypeT type)
   if (type != TS_PP_PARENT && type != TS_PP_GO_DIRECT && type != TS_TYPE_UNDEFINED)
     return NULL;
 
-  ele = (TSParentProxyEle *) xmalloc(sizeof(TSParentProxyEle));
-  if (!ele)
-    return NULL;
+  ele = (TSParentProxyEle *)ats_malloc(sizeof(TSParentProxyEle));
 
   ele->cfg_ele.type = type;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1305,11 +1246,7 @@ TSParentProxyEleDestroy(TSParentProxyEle
 tsapi TSVolumeEle *
 TSVolumeEleCreate()
 {
-  TSVolumeEle *ele;
-
-  ele = (TSVolumeEle *) xmalloc(sizeof(TSVolumeEle));
-  if (!ele)
-    return NULL;
+  TSVolumeEle *ele = (TSVolumeEle *)ats_malloc(sizeof(TSVolumeEle));
 
   ele->cfg_ele.type = TS_VOLUME;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1336,11 +1273,7 @@ TSVolumeEleDestroy(TSVolumeEle * ele)
 tsapi TSPluginEle *
 TSPluginEleCreate()
 {
-  TSPluginEle *ele;
-
-  ele = (TSPluginEle *) xmalloc(sizeof(TSPluginEle));
-  if (!ele)
-    return NULL;
+  TSPluginEle *ele = (TSPluginEle *)ats_malloc(sizeof(TSPluginEle));
 
   ele->cfg_ele.type = TS_PLUGIN;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1376,10 +1309,7 @@ TSRemapEleCreate(TSRuleTypeT type)
       type != TS_REMAP_REDIRECT && type != TS_REMAP_REDIRECT_TEMP && type
!= TS_TYPE_UNDEFINED)
     return NULL;
 
-  ele = (TSRemapEle *) xmalloc(sizeof(TSRemapEle));
-  if (!ele)
-    return NULL;
-
+  ele = (TSRemapEle *)ats_malloc(sizeof(TSRemapEle));
   ele->cfg_ele.type = type;
   ele->cfg_ele.error = TS_ERR_OKAY;
   ele->map = true;
@@ -1417,10 +1347,7 @@ TSRemapEleDestroy(TSRemapEle * ele)
 TSSocksEle *
 TSSocksEleCreate(TSRuleTypeT type)
 {
-  TSSocksEle *ele;
-  ele = (TSSocksEle *) xmalloc(sizeof(TSSocksEle));
-  if (!ele)
-    return NULL;
+  TSSocksEle *ele = (TSSocksEle *)ats_malloc(sizeof(TSSocksEle));
 
   ele->cfg_ele.type = type;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1458,10 +1385,7 @@ TSSocksEleDestroy(TSSocksEle * ele)
 TSSplitDnsEle *
 TSSplitDnsEleCreate()
 {
-  TSSplitDnsEle *ele;
-  ele = (TSSplitDnsEle *) xmalloc(sizeof(TSSplitDnsEle));
-  if (!ele)
-    return NULL;
+  TSSplitDnsEle *ele = (TSSplitDnsEle *)ats_malloc(sizeof(TSSplitDnsEle));
 
   ele->cfg_ele.type = TS_SPLIT_DNS;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1497,10 +1421,7 @@ TSSplitDnsEleDestroy(TSSplitDnsEle * ele
 TSStorageEle *
 TSStorageEleCreate()
 {
-  TSStorageEle *ele;
-  ele = (TSStorageEle *) xmalloc(sizeof(TSStorageEle));
-  if (!ele)
-    return NULL;
+  TSStorageEle *ele = (TSStorageEle *)ats_malloc(sizeof(TSStorageEle));
 
   ele->cfg_ele.type = TS_STORAGE;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1527,10 +1448,7 @@ TSStorageEleDestroy(TSStorageEle * ele)
 TSUpdateEle *
 TSUpdateEleCreate()
 {
-  TSUpdateEle *ele;
-  ele = (TSUpdateEle *) xmalloc(sizeof(TSUpdateEle));
-  if (!ele)
-    return NULL;
+  TSUpdateEle *ele = (TSUpdateEle *)ats_malloc(sizeof(TSUpdateEle));
 
   ele->cfg_ele.type = TS_UPDATE_URL;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1562,10 +1480,7 @@ TSUpdateEleDestroy(TSUpdateEle * ele)
 TSVirtIpAddrEle *
 TSVirtIpAddrEleCreate()
 {
-  TSVirtIpAddrEle *ele;
-  ele = (TSVirtIpAddrEle *) xmalloc(sizeof(TSVirtIpAddrEle));
-  if (!ele)
-    return NULL;
+  TSVirtIpAddrEle *ele = (TSVirtIpAddrEle *)ats_malloc(sizeof(TSVirtIpAddrEle));
 
   ele->cfg_ele.type = TS_VADDRS;
   ele->cfg_ele.error = TS_ERR_OKAY;
@@ -1670,9 +1585,7 @@ TSRecordGetString(const char *rec_name, 
     goto END;
 
   str_size = strlen(ele->string_val) + 1;
-  str = (char *) xmalloc(sizeof(char) * str_size);
-  if (!str)
-    return TS_ERR_SYS_CALL;
+  str = (char *)ats_malloc(sizeof(char) * str_size);
   ink_strncpy(str, ele->string_val, str_size);
   *string_val = str;
 
@@ -2071,9 +1984,7 @@ TSEncryptPassword(char *passwd, char **e
   ink_debug_assert(TS_ENCRYPT_PASSWD_LEN <= passwd_md5_str_len);
 
   const size_t md5StringSize = (passwd_md5_str_len + 1) * sizeof(char);
-  passwd_md5_str = (char *) xmalloc(md5StringSize);
-  if (!passwd_md5_str)
-    return TS_ERR_FAIL;
+  passwd_md5_str = (char *)ats_malloc(md5StringSize);
 
   ink_code_incr_md5_init(&md5_context);
   ink_code_incr_md5_update(&md5_context, passwd, strlen(passwd));

Modified: trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/NetworkUtilsLocal.cc Wed Sep  7 17:28:02 2011
@@ -225,12 +225,7 @@ preprocess_msg(struct SocketInfo sock_in
     *req = NULL;
     Debug("ts_main", "[preprocess_msg] request message = NULL\n");
   } else {
-    *req = (char *) xmalloc(sizeof(char) * (req_len + 1));
-    if (!(*req)) {
-      ret = TS_ERR_SYS_CALL;
-      goto Lerror;
-    }
-
+    *req = (char *)ats_malloc(sizeof(char) * (req_len + 1));
     ret = socket_read_n(sock_info, *req, req_len);
     if (ret != TS_ERR_OKAY) {
       xfree(*req);
@@ -311,9 +306,7 @@ parse_file_write_request(char *req, TSFi
   *size = (int) f_size;
 
   // get file text
-  *text = (char *) xmalloc(sizeof(char) * (f_size + 1));
-  if (!(*text))
-    return TS_ERR_SYS_CALL;
+  *text = (char *)ats_malloc(sizeof(char) * (f_size + 1));
   memcpy(*text, req + SIZE_FILE_T + SIZE_VER + SIZE_LEN, f_size);
   (*text)[f_size] = '\0';       // end buffer
 
@@ -346,17 +339,13 @@ parse_request_name_value(char *req, char
   memcpy(&val_len, req + SIZE_LEN, SIZE_LEN);
 
   // get record name
-  name = (char *) xmalloc(sizeof(char) * (name_len + 1));
-  if (!name)
-    return TS_ERR_SYS_CALL;
+  name = (char *)ats_malloc(sizeof(char) * (name_len + 1));
   memcpy(name, req + SIZE_LEN + SIZE_LEN, name_len);
   name[name_len] = '\0';        // end string
   *name_1 = name;
 
   // get record value - can be a MgmtInt, MgmtCounter ...
-  val = (char *) xmalloc(sizeof(char) * (val_len + 1));
-  if (!val)
-    return TS_ERR_SYS_CALL;
+  val = (char *)ats_malloc(sizeof(char) * (val_len + 1));
   memcpy(val, req + SIZE_LEN + SIZE_LEN + name_len, val_len);
   val[val_len] = '\0';          // end string
   *val_1 = val;
@@ -392,9 +381,7 @@ parse_diags_request(char *req, TSDiagsT 
   memcpy(&msg_len, req + SIZE_DIAGS_T, SIZE_LEN);
 
   // get msg
-  *diag_msg = (char *) xmalloc(sizeof(char) * (msg_len + 1));
-  if (!(*diag_msg))
-    return TS_ERR_SYS_CALL;
+  *diag_msg = (char *)ats_malloc(sizeof(char) * (msg_len + 1));
   memcpy(*diag_msg, req + SIZE_DIAGS_T + SIZE_LEN, msg_len);
   (*diag_msg)[msg_len] = '\0';  // end buffer
 
@@ -491,9 +478,7 @@ send_reply_list(struct SocketInfo sock_i
   }
 
   total_len = SIZE_ERR_T + SIZE_LEN + strlen(list);
-  msg = (char *) xmalloc(sizeof(char) * total_len);
-  if (!msg)
-    return TS_ERR_SYS_CALL;    // ERROR - malloc failed
+  msg = (char *)ats_malloc(sizeof(char) * total_len);
 
   // write the return value
   ret_val = (int16_t) retval;
@@ -544,9 +529,7 @@ send_record_get_reply(struct SocketInfo 
   }
 
   total_len = SIZE_ERR_T + SIZE_LEN + SIZE_REC_T + val_size;
-  msg = (char *) xmalloc(sizeof(char) * total_len);
-  if (!msg)
-    return TS_ERR_SYS_CALL;    // ERROR - malloc failed
+  msg = (char *)ats_malloc(sizeof(char) * total_len);
 
   // write the return value
   ret_val = (int16_t) retval;
@@ -592,9 +575,7 @@ send_record_set_reply(struct SocketInfo 
   int16_t action_t, ret_val;
 
   total_len = SIZE_ERR_T + SIZE_ACTION_T;
-  msg = (char *) xmalloc(sizeof(char) * total_len);
-  if (!msg)
-    return TS_ERR_SYS_CALL;    // ERROR - malloc failed!
+  msg = (char *)ats_malloc(sizeof(char) * total_len);
 
   // write the return value
   ret_val = (int16_t) retval;
@@ -639,9 +620,7 @@ send_file_read_reply(struct SocketInfo s
 
   // allocate space for buffer
   msg_len = SIZE_ERR_T + SIZE_VER + SIZE_LEN + size;
-  msg = (char *) xmalloc(sizeof(char) * msg_len);
-  if (!msg)
-    return TS_ERR_SYS_CALL;
+  msg = (char *)ats_malloc(sizeof(char) * msg_len);
 
   // write the return value
   ret_val = (int16_t) retval;
@@ -718,9 +697,7 @@ send_event_active_reply(struct SocketInf
   int16_t is_active, ret_val;
 
   total_len = SIZE_ERR_T + SIZE_BOOL;
-  msg = (char *) xmalloc(sizeof(char) * total_len);
-  if (!msg)
-    return TS_ERR_SYS_CALL;    // ERROR - malloc failed!
+  msg = (char *)ats_malloc(sizeof(char) * total_len);
 
   // write the return value
   ret_val = (int16_t) retval;
@@ -763,9 +740,7 @@ send_event_notification(struct SocketInf
   name_len = strlen(event->name);
   desc_len = strlen(event->description);
   total_len = SIZE_OP_T + (SIZE_LEN * 2) + name_len + desc_len;
-  msg = (char *) xmalloc(sizeof(char) * total_len);
-  if (!msg)
-    return TS_ERR_SYS_CALL;    // ERROR - malloc failed!
+  msg = (char *)ats_malloc(sizeof(char) * total_len);
 
   // write the operation
   op_t = (int16_t) EVENT_NOTIFY;

Modified: trafficserver/traffic/trunk/mgmt/api/include/mgmtapi.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/include/mgmtapi.h?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/include/mgmtapi.h (original)
+++ trafficserver/traffic/trunk/mgmt/api/include/mgmtapi.h Wed Sep  7 17:28:02 2011
@@ -1053,7 +1053,7 @@ extern "C"
 /*--- password operations -------------------------------------------------*/
 /* TSEncryptPassword: encrypts a password
  * Input: passwd - a password string to encrypt (can be NULL)
- * Output: e_passwd - an encrypted passwd (xmalloc's memory)
+ * Output: e_passwd - an encrypted passwd (ats_malloc's memory)
  */
   tsapi TSError TSEncryptPassword(char *passwd, char **e_passwd);
 

Modified: trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc (original)
+++ trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc Wed Sep  7 17:28:02 2011
@@ -135,7 +135,7 @@ IPRange::read_table_from_file(int fd, co
       if (i == n)
         break;
       if (read_an_ip(line, &ip, &i, n) == 1) {
-        char *error_str = (char *) xmalloc(ERR_STRING_LEN);
+        char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
         snprintf(error_str, ERR_STRING_LEN, "Incorrect Syntax in Socks Configuration at Line
%d", line_no);
         return error_str;
       }
@@ -154,7 +154,7 @@ IPRange::read_table_from_file(int fd, co
         i++;
         ip_ranges_start[(n_ip_ranges)] = ntohl(ip);
         if (read_an_ip(line, &ip, &i, n) == 1) {
-          char *error_str = (char *) xmalloc(ERR_STRING_LEN);
+          char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
           snprintf(error_str, ERR_STRING_LEN, "Incorrect Syntax in Socks Configuration at
Line %d", line_no);
           return error_str;
         }
@@ -166,7 +166,7 @@ IPRange::read_table_from_file(int fd, co
         if (line[i] != ',') {
           TEST(printf("Socks Configuration (read_table_from_file1):Invalid Syntax in line
%s\n", (char *) line);
             );
-          char *error_str = (char *) xmalloc(ERR_STRING_LEN);
+          char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
           snprintf(error_str, ERR_STRING_LEN, "Incorrect Syntax in Socks Configuration at
Line %d", line_no);
           return error_str;
         }
@@ -174,7 +174,7 @@ IPRange::read_table_from_file(int fd, co
       } else {
         TEST(printf("Socks Configuration (read_table_from_file2):Invalid Syntax in line %s\n",
(char *) line);
           );
-        char *error_str = (char *) xmalloc(ERR_STRING_LEN);
+        char *error_str = (char *)ats_malloc(ERR_STRING_LEN);
         snprintf(error_str, ERR_STRING_LEN, "Incorrect Syntax in Socks Configuration at Line
%d", line_no);
         return error_str;
       }

Modified: trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebHttp.cc Wed Sep  7 17:28:02 2011
@@ -698,7 +698,7 @@ WebHttpSetErrorResponse(WebHttpContext *
 char *
 WebHttpAddDocRoot_Xmalloc(WebHttpContext * whc, const char *file, int file_len)
 {
-  char *doc_root_file = (char *)xmalloc(file_len + whc->doc_root_len + 1);
+  char *doc_root_file = (char *)ats_malloc(file_len + whc->doc_root_len + 1);
 
   memcpy(doc_root_file, whc->doc_root, whc->doc_root_len);
   memcpy(doc_root_file + whc->doc_root_len, file, file_len);

Modified: trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc?rev=1166278&r1=1166277&r2=1166278&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebHttpContext.cc Wed Sep  7 17:28:02 2011
@@ -45,7 +45,7 @@ WebHttpContext *
 WebHttpContextCreate(WebHttpConInfo * whci)
 {
 
-  WebHttpContext *whc = (WebHttpContext *) xmalloc(sizeof(WebHttpContext));
+  WebHttpContext *whc = (WebHttpContext *)ats_malloc(sizeof(WebHttpContext));
 
   // memset to 0; note strings are zero'd too
   memset(whc, 0, sizeof(WebHttpContext));



Mime
View raw message