Author: zwoop
Date: Wed Sep 7 17:28:18 2011
New Revision: 1166281
URL: http://svn.apache.org/viewvc?rev=1166281&view=rev
Log:
TS-567 Last xmalloc now converted to ats_malloc
Modified:
trafficserver/traffic/trunk/iocore/cache/CacheDisk.cc
trafficserver/traffic/trunk/iocore/cluster/ClusterLoadMonitor.cc
trafficserver/traffic/trunk/iocore/cluster/ClusterMachine.cc
trafficserver/traffic/trunk/iocore/cluster/P_ClusterCacheInternal.h
trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h
trafficserver/traffic/trunk/iocore/net/NetVCTest.cc
trafficserver/traffic/trunk/iocore/net/SSLCertLookup.cc
trafficserver/traffic/trunk/iocore/utils/Machine.cc
trafficserver/traffic/trunk/lib/records/RecCompatibility.cc
trafficserver/traffic/trunk/lib/records/RecTree.cc
trafficserver/traffic/trunk/lib/ts/Arena.cc
trafficserver/traffic/trunk/lib/ts/TextBuffer.cc
trafficserver/traffic/trunk/lib/ts/Tokenizer.cc
trafficserver/traffic/trunk/lib/ts/ink_base64.cc
trafficserver/traffic/trunk/lib/ts/ink_base64.h
trafficserver/traffic/trunk/lib/ts/ink_killall.cc
trafficserver/traffic/trunk/lib/ts/ink_killall.h
trafficserver/traffic/trunk/lib/ts/ink_resource.h
trafficserver/traffic/trunk/lib/ts/llqueue.cc
trafficserver/traffic/trunk/lib/ts/load_http_hdr.cc
trafficserver/traffic/trunk/mgmt/MultiFile.cc
trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc
trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc
trafficserver/traffic/trunk/mgmt/api/EventCallback.cc
trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc
trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc
trafficserver/traffic/trunk/mgmt/cluster/VMap.cc
trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc
trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc
trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc
Modified: trafficserver/traffic/trunk/iocore/cache/CacheDisk.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheDisk.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheDisk.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheDisk.cc Wed Sep 7 17:28:18
2011
@@ -49,7 +49,7 @@ CacheDisk::open(char *s, off_t blocks, o
start = skip + header_len;
}
- disk_vols = (DiskVol **) xmalloc((l / MIN_VOL_SIZE + 1) * sizeof(DiskVol
**));
+ disk_vols = (DiskVol **)ats_malloc((l / MIN_VOL_SIZE + 1) * sizeof(DiskVol
**));
memset(disk_vols, 0, (l / MIN_VOL_SIZE + 1) * sizeof(DiskVol **));
header_len = ROUND_TO_STORE_BLOCK(header_len);
start = skip + header_len;
Modified: trafficserver/traffic/trunk/iocore/cluster/ClusterLoadMonitor.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cluster/ClusterLoadMonitor.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cluster/ClusterLoadMonitor.cc (original)
+++ trafficserver/traffic/trunk/iocore/cluster/ClusterLoadMonitor.cc Wed Sep 7
17:28:18 2011
@@ -86,11 +86,11 @@ cluster_load_msg_sequence_number(0), clu
Debug("cluster_monitor", "cluster_load_exceed_duration=%d",
cluster_load_exceed_duration);
int nbytes = sizeof(int) * num_ping_response_buckets;
- ping_response_buckets = (int *) xmalloc(nbytes);
+ ping_response_buckets = (int *)ats_malloc(nbytes);
memset((char *) ping_response_buckets, 0, nbytes);
nbytes = sizeof(ink_hrtime) * ping_history_buf_length;
- ping_response_history_buf = (ink_hrtime *) xmalloc(nbytes);
+ ping_response_history_buf = (ink_hrtime *)ats_malloc(nbytes);
memset((char *) ping_response_history_buf, 0, nbytes);
last_ping_message_sent = HRTIME_SECONDS(0);
Modified: trafficserver/traffic/trunk/iocore/cluster/ClusterMachine.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cluster/ClusterMachine.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cluster/ClusterMachine.cc (original)
+++ trafficserver/traffic/trunk/iocore/cluster/ClusterMachine.cc Wed Sep 7
17:28:18 2011
@@ -211,7 +211,7 @@ read_MachineList(char *filename, int afd
if (n == -1 && ParseRules::is_digit(*line)) {
n = atoi(line);
if (n > 0) {
- l = (MachineList *) xmalloc(sizeof(MachineList) + (n - 1) *
sizeof(MachineListElement));
+ l = (MachineList *)ats_malloc(sizeof(MachineList) + (n - 1) *
sizeof(MachineListElement));
l->n = 0;
} else {
l = NULL;
Modified: trafficserver/traffic/trunk/iocore/cluster/P_ClusterCacheInternal.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cluster/P_ClusterCacheInternal.h?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cluster/P_ClusterCacheInternal.h
(original)
+++ trafficserver/traffic/trunk/iocore/cluster/P_ClusterCacheInternal.h Wed Sep
7 17:28:18 2011
@@ -214,7 +214,7 @@ struct CacheContinuation:public Continua
if (rw_buf_msg_len <= DEFAULT_MAX_BUFFER_SIZE) {
rw_buf_msg = new_IOBufferData(buffer_size_to_index(rw_buf_msg_len,
MAX_BUFFER_SIZE_INDEX));
} else {
- rw_buf_msg = new_xmalloc_IOBufferData(xmalloc(rw_buf_msg_len),
rw_buf_msg_len);
+ rw_buf_msg = new_xmalloc_IOBufferData(ats_malloc(rw_buf_msg_len),
rw_buf_msg_len);
}
}
Modified: trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h (original)
+++ trafficserver/traffic/trunk/iocore/eventsystem/P_IOBuffer.h Wed Sep 7
17:28:18 2011
@@ -523,7 +523,7 @@ IOBufferBlock::realloc_xmalloc(void *b,
TS_INLINE void
IOBufferBlock::realloc_xmalloc(int64_t buf_size)
{
- realloc_set_internal(xmalloc(buf_size), buf_size, -buf_size);
+ realloc_set_internal(ats_malloc(buf_size), buf_size, -buf_size);
}
TS_INLINE void
Modified: trafficserver/traffic/trunk/iocore/net/NetVCTest.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/NetVCTest.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/NetVCTest.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/NetVCTest.cc Wed Sep 7 17:28:18 2011
@@ -202,7 +202,7 @@ int
NetVCTest::fill_buffer(MIOBuffer * buf, uint8_t * seed, int bytes)
{
- char *space = (char *) xmalloc(bytes);
+ char *space = (char *)ats_malloc(bytes);
char *tmp = space;
int to_add = bytes;
Modified: trafficserver/traffic/trunk/iocore/net/SSLCertLookup.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/net/SSLCertLookup.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/net/SSLCertLookup.cc (original)
+++ trafficserver/traffic/trunk/iocore/net/SSLCertLookup.cc Wed Sep 7 17:28:18
2011
@@ -162,7 +162,7 @@ SSLCertLookup::extractIPAndCert(matcher_
if (value != NULL) {
int buf_len = sizeof(char) * (strlen(value) + 1);
- *addr = (char *) xmalloc(buf_len);
+ *addr = (char *)ats_malloc(buf_len);
ink_strncpy(*addr, (const char *) value, buf_len);
// testAddr = inet_addr (addr);
}
@@ -172,7 +172,7 @@ SSLCertLookup::extractIPAndCert(matcher_
if (value != NULL) {
int buf_len = sizeof(char) * (strlen(value) + 1);
- *cert = (char *) xmalloc(buf_len);
+ *cert = (char *)ats_malloc(buf_len);
ink_strncpy(*cert, (const char *) value, buf_len);
}
}
@@ -181,7 +181,7 @@ SSLCertLookup::extractIPAndCert(matcher_
if (value != NULL) {
int buf_len = sizeof(char) * (strlen(value) + 1);
- *priKey = (char *) xmalloc(buf_len);
+ *priKey = (char *)ats_malloc(buf_len);
ink_strncpy(*priKey, (const char *) value, buf_len);
}
}
Modified: trafficserver/traffic/trunk/iocore/utils/Machine.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/utils/Machine.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/utils/Machine.cc (original)
+++ trafficserver/traffic/trunk/iocore/utils/Machine.cc Wed Sep 7 17:28:18 2011
@@ -115,11 +115,11 @@ Machine::Machine(char *ahostname, unsign
memset(x, 0, sizeof(x));
*(uint32_t *) & x = (uint32_t) ip;
const size_t ip_string_size = sizeof(char) * 16;
- ip_string = (char *) xmalloc(ip_string_size);
+ ip_string = (char *)ats_malloc(ip_string_size);
snprintf(ip_string, ip_string_size, "%hhu.%hhu.%hhu.%hhu", x[0], x[1], x[2],
x[3]);
ip_string_len = strlen(ip_string);
- ip_hex_string = (char*)xmalloc(9);
+ ip_hex_string = (char*)ats_malloc(9);
memset(ip_hex_string, 0, 9);
nstrhex(ip_hex_string, ip);
ip_hex_string_len = strlen(ip_hex_string);
Modified: trafficserver/traffic/trunk/lib/records/RecCompatibility.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/records/RecCompatibility.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/records/RecCompatibility.cc (original)
+++ trafficserver/traffic/trunk/lib/records/RecCompatibility.cc Wed Sep 7
17:28:18 2011
@@ -107,7 +107,7 @@ RecFileImport_Xmalloc(const char *file,
*file_size = 0;
if ((h_file = RecFileOpenR(file)) != REC_HANDLE_INVALID) {
*file_size = RecFileGetSize(h_file);
- *file_buf = (char *) xmalloc(*file_size + 1);
+ *file_buf = (char *)ats_malloc(*file_size + 1);
if (RecFileRead(h_file, *file_buf, *file_size, &bytes_read) !=
REC_ERR_FAIL && bytes_read == *file_size) {
(*file_buf)[*file_size] = '\0';
err = REC_ERR_OKAY;
Modified: trafficserver/traffic/trunk/lib/records/RecTree.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/records/RecTree.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/records/RecTree.cc (original)
+++ trafficserver/traffic/trunk/lib/records/RecTree.cc Wed Sep 7 17:28:18 2011
@@ -238,9 +238,9 @@ RecTree::rec_tree_get_list(char *path_na
RecTreeDebug("RecTreeGetList subtree %s has %d leafs\n",
subtree->this_node->node_name, (*count));
}
- *buf = (char **) xmalloc(sizeof(char *) * (*count));
+ *buf = (char **)ats_malloc(sizeof(char *) * (*count));
for (i = 0; i < (*count); i++) {
- (*buf)[i] = (char *) xmalloc(sizeof(char));
+ (*buf)[i] = (char *)ats_malloc(sizeof(char));
}
int index = 0;
Modified: trafficserver/traffic/trunk/lib/ts/Arena.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/Arena.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/Arena.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/Arena.cc Wed Sep 7 17:28:18 2011
@@ -44,7 +44,7 @@ blk_alloc(int size)
if (size == DEFAULT_BLOCK_SIZE) {
blk = (ArenaBlock *) defaultSizeArenaBlock.alloc_void();
} else {
- blk = (ArenaBlock *) xmalloc(size + sizeof(ArenaBlock) - 8);
+ blk = (ArenaBlock *)ats_malloc(size + sizeof(ArenaBlock) - 8);
}
blk->next = NULL;
Modified: trafficserver/traffic/trunk/lib/ts/TextBuffer.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/TextBuffer.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/TextBuffer.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/TextBuffer.cc Wed Sep 7 17:28:18 2011
@@ -46,13 +46,11 @@ textBuffer::textBuffer(int size)
size = 1024;
}
- bufferStart = (char *) xmalloc(size);
- if (bufferStart != NULL) {
- nextAdd = bufferStart;
- currentSize = size;
- spaceLeft = size - 1; // Leave room for a terminator;
- nextAdd[0] = '\0';
- }
+ bufferStart = (char *)ats_malloc(size);
+ nextAdd = bufferStart;
+ currentSize = size;
+ spaceLeft = size - 1; // Leave room for a terminator;
+ nextAdd[0] = '\0';
}
}
Modified: trafficserver/traffic/trunk/lib/ts/Tokenizer.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/Tokenizer.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/Tokenizer.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/Tokenizer.cc Wed Sep 7 17:28:18 2011
@@ -241,7 +241,7 @@ Tokenizer::addToken(char *startAddr, int
startAddr[length] = '\0';
add_ptr = startAddr;
} else {
- add_ptr = (char *) xmalloc(length + 1);
+ add_ptr = (char *)ats_malloc(length + 1);
memcpy(add_ptr, startAddr, length);
add_ptr[length] = '\0';
}
@@ -256,7 +256,7 @@ Tokenizer::addToken(char *startAddr, int
// if there is not a next one
if (add_index >= TOK_NODE_ELEMENTS) {
if (add_node->next == NULL) {
- add_node->next = (tok_node *) xmalloc(sizeof(tok_node));
+ add_node->next = (tok_node *)ats_malloc(sizeof(tok_node));
memset(add_node->next, 0, sizeof(tok_node));
}
add_node = add_node->next;
Modified: trafficserver/traffic/trunk/lib/ts/ink_base64.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_base64.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_base64.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_base64.cc Wed Sep 7 17:28:18 2011
@@ -46,7 +46,7 @@
#endif
#define decode(A) ((unsigned int)codes[(unsigned char)input[A]])
-// NOTE: ink_base64_decode returns xmalloc'd memory
+// NOTE: ink_base64_decode returns ats_xmalloc'd memory
char *
ink_base64_decode(const char *input, int input_len, int *output_len)
@@ -76,9 +76,7 @@ ink_base64_decode(const char *input, int
// compute ciphertext length
for (len = 0; len < input_len && input[len] != '='; len++);
- output = obuf = (char *) xmalloc((len * 6) / 8 + 4);
- ink_assert(output != NULL);
-
+ output = obuf = (char *)ats_malloc((len * 6) / 8 + 4);
while (len > 0) {
*output++ = decode(0) << 2 | decode(1) >> 4;
*output++ = decode(1) << 4 | decode(2) >> 2;
@@ -104,7 +102,7 @@ ink_base64_decode(const char *input, int
/*-------------------------------------------------------------------------
-------------------------------------------------------------------------*/
-// NOTE: ink_base64_encode returns xmalloc'd memory
+// NOTE: ink_base64_encode returns ats_malloc'd memory
char *
ink_base64_encode(const char *input, int input_len, int *output_len)
@@ -123,9 +121,7 @@ ink_base64_encode_unsigned(const unsigne
len = input_len;
- output = obuf = (char *) xmalloc((len * 8) / 6 + 4);
- ink_assert(output != NULL);
-
+ output = obuf = (char *)ats_malloc((len * 8) / 6 + 4);
while (len > 2) {
*output++ = codes[(input[0] >> 2) & 077];
Modified: trafficserver/traffic/trunk/lib/ts/ink_base64.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_base64.h?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_base64.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_base64.h Wed Sep 7 17:28:18 2011
@@ -37,7 +37,7 @@
*
*/
-// These functions return xmalloc'd memory which caller needs to xfree
+// These functions return ats_malloc'd memory which caller needs to xfree
inkcoreapi char *ink_base64_decode(const char *input, int input_len, int
*output_len);
char *ink_base64_encode(const char *input, int input_len, int *output_len);
char *ink_base64_encode_unsigned(const unsigned char *input, int input_len,
int *output_len);
Modified: trafficserver/traffic/trunk/lib/ts/ink_killall.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_killall.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_killall.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_killall.cc Wed Sep 7 17:28:18 2011
@@ -79,8 +79,7 @@ ink_killall_get_pidv_xmalloc(const char
goto l_error;
*pidvcnt = 0;
- if (!(*pidv = (pid_t *) xmalloc(pidvsize * sizeof(pid_t))))
- goto l_error;
+ *pidv = (pid_t *)ats_malloc(pidvsize * sizeof(pid_t));
while ((de = readdir(dir))) {
if (!(pid = (pid_t) atoi(de->d_name)) || pid == self)
Modified: trafficserver/traffic/trunk/lib/ts/ink_killall.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_killall.h?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_killall.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_killall.h Wed Sep 7 17:28:18 2011
@@ -42,10 +42,10 @@ int ink_killall(const char *pname, int s
/*-------------------------------------------------------------------------
ink_killall_get_pidv_xmalloc
- - Get all pid's named 'pname' and stores into xmalloc'd
+ - Get all pid's named 'pname' and stores into ats_malloc'd
pid_t array, 'pidv'
- Returns: -1 error (pidv: set to NULL; pidvcnt: set to 0)
- 0 okay (pidv: xmalloc'd pid vector; pidvcnt: number of pid's;
+ 0 okay (pidv: ats_malloc'd pid vector; pidvcnt: number of pid's;
if pidvcnt is set to 0, then pidv will be set to NULL)
-------------------------------------------------------------------------*/
int ink_killall_get_pidv_xmalloc(const char *pname, pid_t ** pidv, int
*pidvcnt);
Modified: trafficserver/traffic/trunk/lib/ts/ink_resource.h
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_resource.h?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_resource.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_resource.h Wed Sep 7 17:28:18 2011
@@ -69,7 +69,6 @@ xfree_null(void *mem)
}
#endif
-#define xmalloc(s) ats_malloc ((s))
#define xrealloc(p,s) ats_realloc ((p),(s))
#define xstrdup(p) _xstrdup ((p), -1, NULL)
#define xstrndup(p,n) _xstrdup ((p), n, NULL)
@@ -101,14 +100,14 @@ public:
{ }
/// Construct from allocated memory.
- /// @note @a ptr must refer to memory allocated @c xmalloc.
+ /// @note @a ptr must refer to memory allocated @c ats_malloc.
explicit xptr(T* ptr)
: m_ptr(ptr)
{ }
/// Construct and initialized with memory for @a n instances of @a T.
explicit xptr(size_t n)
- : m_ptr(xmalloc(sizeof(T) * n))
+ : m_ptr(ats_malloc(sizeof(T) * n))
{ }
/// Destructor - free memory held by this instance.
@@ -118,7 +117,7 @@ public:
}
/// Assign memory.
- /// @note @a ptr must be allocated via @c xmalloc.
+ /// @note @a ptr must be allocated via @c ats_malloc.
self& operator = (T* ptr) {
xfree(m_ptr);
m_ptr = ptr;
@@ -162,7 +161,7 @@ private:
/** Combine two strings as file paths.
Trailing and leading separators for @a lhs and @a rhs respectively
are handled to yield exactly one separator.
- @return A newly @x xmalloc string of the combined paths.
+ @return A newly @x ats_malloc string of the combined paths.
*/
inline char*
path_join (xptr<char> const& lhs, xptr<char> const& rhs)
@@ -174,7 +173,7 @@ path_join (xptr<char> const& lhs, xptr<c
if (ln && lhs[ln-1] == '/') --ln; // drop trailing separator.
if (rn && *rptr == '/') --rn, ++rptr; // drop leading separator.
- char* x = static_cast<char*>(xmalloc(ln + rn + 2));
+ char* x = static_cast<char*>(ats_malloc(ln + rn + 2));
memcpy(x, lhs, ln);
x[ln] = '/';
Modified: trafficserver/traffic/trunk/lib/ts/llqueue.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/llqueue.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/llqueue.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/llqueue.cc Wed Sep 7 17:28:18 2011
@@ -52,12 +52,7 @@ newrec(LLQ * Q)
return new_val;
}
-
- Q->free = (LLQrec *) xmalloc(RECORD_CHUNK * sizeof(LLQrec));
-
- if (!Q->free)
- return NULL;
-
+ Q->free = (LLQrec *)ats_malloc(RECORD_CHUNK * sizeof(LLQrec));
for (i = 0; i < RECORD_CHUNK; i++)
Q->free[i].next = &Q->free[i + 1];
@@ -83,11 +78,7 @@ LLQ *
create_queue()
{
const char *totally_bogus_name = "create_queue";
- LLQ * new_val;
-
- new_val = (LLQ *) xmalloc(sizeof(LLQ));
- if (!new_val)
- return NULL;
+ LLQ * new_val = (LLQ *)ats_malloc(sizeof(LLQ));
#if defined(darwin)
static int qnum = 0;
@@ -127,15 +118,7 @@ enqueue(LLQ * Q, void *data)
LLQrec * new_val;
ink_mutex_acquire(&(Q->mux));
-
-//new_val= newrec(Q);
- new_val = (LLQrec *) xmalloc(sizeof(LLQrec));
-
- if (!new_val) {
- ink_mutex_release(&(Q->mux));
- return 0;
- }
-
+ new_val = (LLQrec *)ats_malloc(sizeof(LLQrec));
new_val->data = data;
new_val->next = NULL;
Modified: trafficserver/traffic/trunk/lib/ts/load_http_hdr.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/load_http_hdr.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/load_http_hdr.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/load_http_hdr.cc Wed Sep 7 17:28:18 2011
@@ -118,7 +118,7 @@ load_buffer(int fd, hdr_type h_type)
exit(1);
}
- char *file_buf = (char *) xmalloc(sizeof(char) * (s_info.st_size + 1));
+ char *file_buf = (char *)ats_malloc(sizeof(char) * (s_info.st_size + 1));
file_buf[s_info.st_size] = '\0';
@@ -161,7 +161,7 @@ load_buffer(int fd, hdr_type h_type)
mbuf_size *= 2;
}
- char *mbuf = (char *) xmalloc(mbuf_size);
+ char *mbuf = (char *)ats_malloc(mbuf_size);
int bytes_read = 0;
int cur_line = 0;
Modified: trafficserver/traffic/trunk/mgmt/MultiFile.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/MultiFile.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/MultiFile.cc (original)
+++ trafficserver/traffic/trunk/mgmt/MultiFile.cc Wed Sep 7 17:28:18 2011
@@ -121,7 +121,7 @@ MultiFile::WalkFiles(ExpandingArray * fi
// The fun of Solaris - readdir_r requires a buffer passed into it
// The man page says this obscene expression gives us the proper
// size
- dirEntry = (struct dirent *) xmalloc(sizeof(struct dirent) + pathconf(".",
_PC_NAME_MAX) + 1);
+ dirEntry = (struct dirent *)ats_malloc(sizeof(struct dirent) + pathconf(".",
_PC_NAME_MAX) + 1);
struct dirent *result;
while (readdir_r(dir, dirEntry, &result) == 0) {
@@ -139,7 +139,7 @@ MultiFile::WalkFiles(ExpandingArray * fi
}
// Ignore ., .., and any dot files
if (*fileName != '.' && isManaged(fileName)) {
- fileListEntry = (fileEntry *) xmalloc(sizeof(fileEntry));
+ fileListEntry = (fileEntry *)ats_malloc(sizeof(fileEntry));
fileListEntry->c_time = fileInfo.st_ctime;
ink_strncpy(fileListEntry->name, fileName,
sizeof(fileListEntry->name));
fileList->addEntry(fileListEntry);
@@ -170,7 +170,7 @@ MultiFile::WalkFiles(ExpandingArray * fi
} else {
// Ignore ., .., and any dot files
if (*fileName != '.' && isManaged(fileName)) {
- fileListEntry = (fileEntry *) xmalloc(sizeof(fileEntry));
+ fileListEntry = (fileEntry *)ats_malloc(sizeof(fileEntry));
fileListEntry->c_time = fileInfo.st_ctime;
strcpy(fileListEntry->name, fileName);
fileList->addEntry(fileListEntry);
Modified: trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/CfgContextManager.cc Wed Sep 7
17:28:18 2011
@@ -99,7 +99,7 @@ CfgContextCommit(CfgContext * ctx, LLQ *
if (!ctx)
return TS_ERR_PARAMS;
- new_text = (char *) xmalloc(max_file_size + 1);
+ new_text = (char *)ats_malloc(max_file_size + 1);
new_text[0] = '\0';
ele = ctx->first();
index = 0;
@@ -109,7 +109,7 @@ CfgContextCommit(CfgContext * ctx, LLQ *
err = TS_ERR_INVALID_CONFIG_RULE;
rule = xstrdup(FORMAT_TO_RULE_ERROR);
if (errRules) {
- iPtr = (int *) xmalloc(sizeof(int));
+ iPtr = (int *)ats_malloc(sizeof(int));
*iPtr = index;
enqueue(errRules, (void *) iPtr);
}
Modified: trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/CfgContextUtils.cc Wed Sep 7 17:28:18
2011
@@ -612,11 +612,9 @@ string_to_int_list(const char *str_list,
for (i = 0; i < numToks; i++) {
if (!isNumber(tokens[i]))
goto Lerror;
- ele = (int *) xmalloc(sizeof(int));
- if (ele) {
- *ele = ink_atoi(tokens[i]); // What about we can't convert? ERROR?
- TSIntListEnqueue(list, ele);
- }
+ ele = (int *)ats_malloc(sizeof(int));
+ *ele = ink_atoi(tokens[i]); // What about we can't convert? ERROR?
+ TSIntListEnqueue(list, ele);
}
return list;
Modified: trafficserver/traffic/trunk/mgmt/api/EventCallback.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/EventCallback.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/EventCallback.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/EventCallback.cc Wed Sep 7 17:28:18
2011
@@ -47,9 +47,8 @@
EventCallbackT *
create_event_callback(TSEventSignalFunc func, void *data)
{
- EventCallbackT *event_cb;
+ EventCallbackT *event_cb = (EventCallbackT
*)ats_malloc(sizeof(EventCallbackT));
- event_cb = (EventCallbackT *) xmalloc(sizeof(EventCallbackT));
event_cb->func = func;
event_cb->data = data;
@@ -88,23 +87,13 @@ delete_event_callback(EventCallbackT * e
CallbackTable *
create_callback_table(const char *lock_name)
{
- CallbackTable *cb_table;
-
- cb_table = (CallbackTable *) xmalloc(sizeof(CallbackTable));
-
- if (cb_table) {
- for (int i = 0; i < NUM_EVENTS; i++) {
- cb_table->event_callback_l[i] = NULL;
- }
+ CallbackTable *cb_table = (CallbackTable *)ats_malloc(sizeof(CallbackTable));
- // initialize the mutex
- ink_mutex_init(&cb_table->event_callback_lock, lock_name);
- }
-
- if (!cb_table) {
- return NULL;
- }
+ for (int i = 0; i < NUM_EVENTS; i++)
+ cb_table->event_callback_l[i] = NULL;
+ // initialize the mutex
+ ink_mutex_init(&cb_table->event_callback_lock, lock_name);
return cb_table;
}
Modified: trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/EventControlMain.cc Wed Sep 7
17:28:18 2011
@@ -54,20 +54,13 @@ InkHashTable *accepted_clients; // list
EventClientT *
new_event_client()
{
- EventClientT *ele;
-
- ele = (EventClientT *) xmalloc(sizeof(EventClientT));
- if (!ele)
- return NULL;
+ EventClientT *ele = (EventClientT *)ats_malloc(sizeof(EventClientT));
// now set the alarms registered section
for (int i = 0; i < NUM_EVENTS; i++)
ele->events_registered[i] = 0;
- ele->adr = (struct sockaddr *) xmalloc(sizeof(struct sockaddr));
- if (!ele->adr)
- return NULL;
-
+ ele->adr = (struct sockaddr *)ats_malloc(sizeof(struct sockaddr));
return ele;
}
Modified: trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/TSControlMain.cc Wed Sep 7 17:28:18
2011
@@ -58,16 +58,9 @@ InkHashTable *accepted_con; // a lis
ClientT *
create_client()
{
- ClientT *ele;
-
- ele = (ClientT *) xmalloc(sizeof(ClientT));
- if (!ele)
- return NULL;
-
- ele->adr = (struct sockaddr *) xmalloc(sizeof(struct sockaddr));
- if (!ele->adr)
- return NULL;
+ ClientT *ele = (ClientT *)ats_malloc(sizeof(ClientT));
+ ele->adr = (struct sockaddr *)ats_malloc(sizeof(struct sockaddr));
return ele;
}
Modified: trafficserver/traffic/trunk/mgmt/cluster/VMap.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/cluster/VMap.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/cluster/VMap.cc (original)
+++ trafficserver/traffic/trunk/mgmt/cluster/VMap.cc Wed Sep 7 17:28:18 2011
@@ -154,7 +154,7 @@ VMap::VMap(char *interface, unsigned lon
tmp_addr.s_addr = ip;
- ink_assert((tmp_realip_info = (RealIPInfo *) xmalloc(sizeof(RealIPInfo))));
+ tmp_realip_info = (RealIPInfo *)ats_malloc(sizeof(RealIPInfo));
tmp_realip_info->real_ip = tmp_addr;
tmp_realip_info->mappings_for_interface = true;
@@ -184,7 +184,7 @@ VMap::VMap(char *interface, unsigned lon
lastlen = 0;
len = 128 * sizeof(struct ifreq); // initial buffer size guess
for (;;) {
- ifbuf = (char *) xmalloc(len);
+ ifbuf = (char *)ats_malloc(len);
memset(ifbuf, 0, len); // prevent UMRs
ifc.ifc_len = len;
ifc.ifc_buf = ifbuf;
@@ -220,7 +220,7 @@ VMap::VMap(char *interface, unsigned lon
tmp = (struct sockaddr_in *) &ifr->ifr_ifru.ifru_addr;
- ink_assert((tmp_realip_info = (RealIPInfo *)
xmalloc(sizeof(RealIPInfo))));
+ tmp_realip_info = (RealIPInfo *)ats_malloc(sizeof(RealIPInfo));
tmp_realip_info->real_ip = tmp->sin_addr;
tmp_realip_info->mappings_for_interface = false;
@@ -413,7 +413,7 @@ VMap::lt_readAListFile(char *data)
num_addrs = tmp_num_addrs;
if (num_addrs) {
- addr_list = (unsigned long *) xmalloc(sizeof(unsigned long) * num_addrs);
+ addr_list = (unsigned long *)ats_malloc(sizeof(unsigned long) * num_addrs);
} else { /* Handle the case where there are no addrs in
the file */
addr_list = NULL;
fclose(fin);
@@ -439,7 +439,7 @@ VMap::lt_readAListFile(char *data)
addr_list[tmp_num_addrs++] = inet_addr(tmp_addr);
- ink_assert((tmp_val = (VIPInfo *) xmalloc(sizeof(VIPInfo))));
+ tmp_val = (VIPInfo *)ats_malloc(sizeof(VIPInfo));
strncpy(tmp_val->interface, tmp_interface, MAX_INTERFACE - 2);
strncpy(tmp_val->sub_interface_id, tmp_id, MAX_SUB_ID - 2);
@@ -593,7 +593,7 @@ VMap::rl_map(char *virt_ip, char *real_i
return false;
}
- ink_assert((entry = (bool *) xmalloc(sizeof(bool))));
+ entry = (bool *)ats_malloc(sizeof(bool));
*entry = true;
if (!real_ip) {
@@ -684,7 +684,7 @@ VMap::rl_checkConflict(char *virt_ip)
mgmt_fatal(stderr, "[VMap::rl_checkConflict] Corrupt VMap entry('%s'),
bailing\n", key);
}
size_t buf3_len = strlen(buf2) * sizeof(char) + 1;
- ink_assert((buf3 = (char *) xmalloc(buf3_len)));
+ buf3 = (char *)ats_malloc(buf3_len);
ink_strncpy(buf3, buf2, buf3_len);
return buf3;
}
Modified: trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc (original)
+++ trafficserver/traffic/trunk/mgmt/utils/ExpandingArray.cc Wed Sep 7
17:28:18 2011
@@ -33,7 +33,7 @@ ExpandingArray::ExpandingArray(int initi
initialSize = EA_MIN_SIZE;
}
- internalArray = (void **) xmalloc(initialSize * sizeof(void *));
+ internalArray = (void **)ats_malloc(initialSize * sizeof(void *));
freeContentsOnDestruct = freeContents;
internalArraySize = initialSize;
Modified: trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebCompatibility.cc Wed Sep 7
17:28:18 2011
@@ -49,7 +49,7 @@ WebGetHostname_Xmalloc(sockaddr_in * cli
hostname_tmp = r ? r->h_name : inet_ntoa(client_info->sin_addr);
size_t len = strlen(hostname_tmp) + 1;
- hostname = (char *) xmalloc(len);
+ hostname = (char *)ats_malloc(len);
ink_strncpy(hostname, hostname_tmp, len);
return hostname;
@@ -149,7 +149,7 @@ WebFileImport_Xmalloc(const char *file,
if ((h_file = WebFileOpenR(file)) == WEB_HANDLE_INVALID)
goto Lerror;
*file_size = WebFileGetSize(h_file);
- *file_buf = (char *) xmalloc(*file_size + 1);
+ *file_buf = (char *)ats_malloc(*file_size + 1);
if (WebFileRead(h_file, *file_buf, *file_size, &bytes_read) ==
WEB_HTTP_ERR_FAIL)
goto Lerror;
if (bytes_read != *file_size)
Modified: trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc
URL:
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc?rev=1166281&r1=1166280&r2=1166281&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc (original)
+++ trafficserver/traffic/trunk/mgmt/web2/WebHttpSession.cc Wed Sep 7 17:28:18
2011
@@ -143,7 +143,7 @@ WebHttpSessionStore(char *key, void *dat
goto Ldone;
}
time(&now);
- session = (session_ele *) xmalloc(sizeof(session_ele));
+ session = (session_ele *)ats_malloc(sizeof(session_ele));
session->created = now;
session->data = data;
session->deleter_func = deleter_func;
@@ -205,10 +205,10 @@ Ldone:
char *
WebHttpMakeSessionKey_Xmalloc()
{
- char *session_key_str = (char *) xmalloc(SESSION_KEY_LEN + 2);
+ char *session_key_str = (char *)ats_malloc(SESSION_KEY_LEN + 2);
long session_key = WebRand();
// note: snprintf takes the buffer length, not the string
- // length? Add 2 to xmalloc above to be safe. ^_^
+ // length? Add 2 to ats_malloc above to be safe. ^_^
snprintf(session_key_str, SESSION_KEY_LEN + 1, "%lx", session_key);
return session_key_str;
}