Skip to content

Commit

Permalink
TS-567 Change xstrdup/xstrndup to ats_strdup/ats_strndup
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/trafficserver/traffic/trunk@1166456 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
zwoop committed Sep 7, 2011
1 parent f2088d3 commit 51a214f
Show file tree
Hide file tree
Showing 77 changed files with 437 additions and 448 deletions.
2 changes: 1 addition & 1 deletion cop/TrafficCop.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ build_config_table(FILE * fp)
} }
varname[i] = '\0'; varname[i] = '\0';


ink_hash_table_insert(configTable, varname, xstrdup(buffer)); ink_hash_table_insert(configTable, varname, ats_strdup(buffer));
} }
#ifdef TRACE_LOG_COP #ifdef TRACE_LOG_COP
cop_log(COP_DEBUG, "Leaving build_config_table(%d)\n", fp); cop_log(COP_DEBUG, "Leaving build_config_table(%d)\n", fp);
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/Cache.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ int
Vol::init(char *s, off_t blocks, off_t dir_skip, bool clear) Vol::init(char *s, off_t blocks, off_t dir_skip, bool clear)
{ {
dir_skip = ROUND_TO_STORE_BLOCK((dir_skip < START_POS ? START_POS : dir_skip)); dir_skip = ROUND_TO_STORE_BLOCK((dir_skip < START_POS ? START_POS : dir_skip));
path = xstrdup(s); path = ats_strdup(s);
const size_t hash_id_size = strlen(s) + 32; const size_t hash_id_size = strlen(s) + 32;
hash_id = (char *)ats_malloc(hash_id_size); hash_id = (char *)ats_malloc(hash_id_size);
ink_strncpy(hash_id, s, hash_id_size); ink_strncpy(hash_id, s, hash_id_size);
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/CacheDisk.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
int int
CacheDisk::open(char *s, off_t blocks, off_t askip, int ahw_sector_size, int fildes, bool clear) CacheDisk::open(char *s, off_t blocks, off_t askip, int ahw_sector_size, int fildes, bool clear)
{ {
path = xstrdup(s); path = ats_strdup(s);
hw_sector_size = ahw_sector_size; hw_sector_size = ahw_sector_size;
fd = fildes; fd = fildes;
skip = askip; skip = askip;
Expand Down
2 changes: 1 addition & 1 deletion iocore/cache/CacheHosting.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ CacheHostRecord::Init(matcher_line * line_info, int typ)


if (!strcasecmp(label, "volume")) { if (!strcasecmp(label, "volume")) {
/* parse the list of volumes */ /* parse the list of volumes */
val = xstrdup(line_info->line[1][i]); val = ats_strdup(line_info->line[1][i]);
char *vol_no = val; char *vol_no = val;
char *s = val; char *s = val;
int volume_number; int volume_number;
Expand Down
18 changes: 9 additions & 9 deletions iocore/cache/Store.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ Span::init(char *an, int64_t size)
disk_id = devnum; disk_id = devnum;
} }


pathname = xstrdup(an); pathname = ats_strdup(an);
blocks = size / STORE_BLOCK_SIZE; blocks = size / STORE_BLOCK_SIZE;
file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR); file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR);


Expand Down Expand Up @@ -624,7 +624,7 @@ Span::init(char *filename, int64_t size)
disk_id = devnum; disk_id = devnum;
} }


pathname = xstrdup(filename); pathname = ats_strdup(filename);
// is this right Seems like this should be size / hw_sector_size // is this right Seems like this should be size / hw_sector_size
blocks = size / STORE_BLOCK_SIZE; blocks = size / STORE_BLOCK_SIZE;
file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR); file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR);
Expand Down Expand Up @@ -754,7 +754,7 @@ Span::init(char *filename, int64_t size)
Debug("cache_init", "Span::init physical sectors %u total size %" PRId64 " geometry size %" PRId64 " store blocks %" PRId64 "", Debug("cache_init", "Span::init physical sectors %u total size %" PRId64 " geometry size %" PRId64 " store blocks %" PRId64 "",
physsectors, hw_sector_size * (int64_t)physsectors, size, blocks); physsectors, hw_sector_size * (int64_t)physsectors, size, blocks);


pathname = xstrdup(filename); pathname = ats_strdup(filename);
file_pathname = 1; file_pathname = 1;
} else { } else {
Debug("cache_init", "Span::init - is_disk = %d, raw device = %s", is_disk, (major(devnum) == 162) ? "yes" : "no"); Debug("cache_init", "Span::init - is_disk = %d, raw device = %s", is_disk, (major(devnum) == 162) ? "yes" : "no");
Expand All @@ -767,7 +767,7 @@ Span::init(char *filename, int64_t size)
is_disk = 1; is_disk = 1;
is_mmapable_internal = false; /* I -think- */ is_mmapable_internal = false; /* I -think- */
file_pathname = 1; file_pathname = 1;
pathname = xstrdup(filename); pathname = ats_strdup(filename);
isRaw = 1; isRaw = 1;


if (size <= 0) if (size <= 0)
Expand All @@ -780,7 +780,7 @@ Span::init(char *filename, int64_t size)
* don't particularly understand that behaviour, so I'll just ignore it. * don't particularly understand that behaviour, so I'll just ignore it.
* :) */ * :) */


pathname = xstrdup(filename); pathname = ats_strdup(filename);
if (!file_pathname) if (!file_pathname)
if (size <= 0) if (size <= 0)
return "When using directories for cache storage, you must specify a size\n"; return "When using directories for cache storage, you must specify a size\n";
Expand Down Expand Up @@ -823,7 +823,7 @@ try_alloc(Store & target, Span * source, unsigned int start_blocks, bool one_onl
a = blocks; a = blocks;
Span *d = NEW(new Span(*source)); Span *d = NEW(new Span(*source));


d->pathname = xstrdup(source->pathname); d->pathname = ats_strdup(source->pathname);
d->blocks = a; d->blocks = a;
d->file_pathname = source->file_pathname; d->file_pathname = source->file_pathname;
d->offset = source->offset; d->offset = source->offset;
Expand Down Expand Up @@ -899,7 +899,7 @@ Store::try_realloc(Store & s, Store & diff)
goto Lfound; goto Lfound;
} else { } else {
Span *x = NEW(new Span(*d)); Span *x = NEW(new Span(*d));
x->pathname = xstrdup(x->pathname); x->pathname = ats_strdup(x->pathname);
// d will be the first vol // d will be the first vol
d->blocks = sd->offset - d->offset; d->blocks = sd->offset - d->offset;
d->link.next = x; d->link.next = x;
Expand Down Expand Up @@ -1021,7 +1021,7 @@ Span::read(int fd)
if (sscanf(buf, "%s", p) != 1) { if (sscanf(buf, "%s", p) != 1) {
return (-1); return (-1);
} }
pathname = xstrdup(p); pathname = ats_strdup(p);
if (get_int64(fd, blocks) < 0) { if (get_int64(fd, blocks) < 0) {
return -1; return -1;
} }
Expand Down Expand Up @@ -1120,7 +1120,7 @@ Span *
Span::dup() Span::dup()
{ {
Span *ds = NEW(new Span(*this)); Span *ds = NEW(new Span(*this));
ds->pathname = xstrdup(pathname); ds->pathname = ats_strdup(pathname);
if (ds->link.next) if (ds->link.next)
ds->link.next = ds->link.next->dup(); ds->link.next = ds->link.next->dup();
return ds; return ds;
Expand Down
10 changes: 5 additions & 5 deletions iocore/cluster/ClusterMachine.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ clusterHandler(0)
ink_release_assert(!gethostname(localhost, 1023)); ink_release_assert(!gethostname(localhost, 1023));
ahostname = localhost; ahostname = localhost;
} }
hostname = xstrdup(ahostname); hostname = ats_strdup(ahostname);


// If we are running if the manager, it the our ip address for // If we are running if the manager, it the our ip address for
// clustering from the manager, so the manager can control what // clustering from the manager, so the manager can control what
Expand Down Expand Up @@ -135,7 +135,7 @@ clusterHandler(0)
*(uint32_t *) & x = (uint32_t) ip; *(uint32_t *) & x = (uint32_t) ip;
Debug("machine_debug", "unable to reverse DNS %u.%u.%u.%u: %d", x[0], x[1], x[2], x[3], data.herrno); Debug("machine_debug", "unable to reverse DNS %u.%u.%u.%u: %d", x[0], x[1], x[2], x[3], data.herrno);
} else } else
hostname = xstrdup(r->h_name); hostname = ats_strdup(r->h_name);
} }
if (hostname) if (hostname)
hostname_len = strlen(hostname); hostname_len = strlen(hostname);
Expand Down Expand Up @@ -230,7 +230,7 @@ read_MachineList(char *filename, int afd)
} else { } else {
char s[256]; char s[256];
snprintf(s, sizeof s, "bad ip, line %d", ln); snprintf(s, sizeof s, "bad ip, line %d", ln);
return (MachineList *) xstrdup(s); return (MachineList *) ats_strdup(s);
} }
} }
l->machine[i].port = atoi(port); l->machine[i].port = atoi(port);
Expand All @@ -246,7 +246,7 @@ read_MachineList(char *filename, int afd)
} else { } else {
char s[256]; char s[256];
snprintf(s, sizeof s, "bad port, line %d", ln); snprintf(s, sizeof s, "bad port, line %d", ln);
return (MachineList *) xstrdup(s); return (MachineList *) ats_strdup(s);
} }
} }
} }
Expand All @@ -262,7 +262,7 @@ read_MachineList(char *filename, int afd)
return NULL; return NULL;
} else } else
ats_free(l); ats_free(l);
return (MachineList *) xstrdup("number of machines does not match length of list\n"); return (MachineList *) ats_strdup("number of machines does not match length of list\n");
} }
} }
return (afd != -1) ? (MachineList *) NULL : l; return (afd != -1) ? (MachineList *) NULL : l;
Expand Down
2 changes: 1 addition & 1 deletion iocore/cluster/ClusterProcessor.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ ClusterProcessor::connect(char *hostname)
// //
ClusterHandler *ch = NEW(new ClusterHandler); ClusterHandler *ch = NEW(new ClusterHandler);
SET_CONTINUATION_HANDLER(ch, (ClusterContHandler) & ClusterHandler::connectClusterEvent); SET_CONTINUATION_HANDLER(ch, (ClusterContHandler) & ClusterHandler::connectClusterEvent);
ch->hostname = xstrdup(hostname); ch->hostname = ats_strdup(hostname);
ch->connector = true; ch->connector = true;
eventProcessor.schedule_imm(ch, ET_CLUSTER); eventProcessor.schedule_imm(ch, ET_CLUSTER);
} }
Expand Down
2 changes: 1 addition & 1 deletion iocore/dns/DNS.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ DNSProcessor::dns_init()
Debug("dns", "Nameserver list specified \"%s\"\n", dns_ns_list); Debug("dns", "Nameserver list specified \"%s\"\n", dns_ns_list);
int i; int i;
char *last; char *last;
char *ns_list = xstrdup(dns_ns_list); char *ns_list = ats_strdup(dns_ns_list);
char *ns = (char *) ink_strtok_r(ns_list, " ,;\t\r", &last); char *ns = (char *) ink_strtok_r(ns_list, " ,;\t\r", &last);


for (i = 0, nserv = 0 ; (i < MAX_NAMED) && ns ; ++i) { for (i = 0, nserv = 0 ; (i < MAX_NAMED) && ns ; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion iocore/dns/P_SplitDNSProcessor.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ TS_INLINE DNSRequestData::DNSRequestData()
TS_INLINE char * TS_INLINE char *
DNSRequestData::get_string() DNSRequestData::get_string()
{ {
return xstrdup((char *) m_pHost); return ats_strdup((char *) m_pHost);
} }




Expand Down
4 changes: 2 additions & 2 deletions iocore/hostdb/HostDB.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2241,7 +2241,7 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
s->force = !ptr_len_ncasecmp(path + 3, path_len - 3, "force", 5); s->force = !ptr_len_ncasecmp(path + 3, path_len - 3, "force", 5);
int query_len; int query_len;
const char *query = h->url_get()->query_get(&query_len); const char *query = h->url_get()->query_get(&query_len);
s->sarg = xstrndup(query, query_len); s->sarg = ats_strndup(query, query_len);
char *gn = NULL; char *gn = NULL;
if (s->sarg) if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg)); gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
Expand All @@ -2253,7 +2253,7 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
s->force = !ptr_len_ncasecmp(path + 5, path_len - 5, "force", 5); s->force = !ptr_len_ncasecmp(path + 5, path_len - 5, "force", 5);
int query_len; int query_len;
const char *query = h->url_get()->query_get(&query_len); const char *query = h->url_get()->query_get(&query_len);
s->sarg = xstrndup(query, query_len); s->sarg = ats_strndup(query, query_len);
char *gn = NULL; char *gn = NULL;
if (s->sarg) if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg)); gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
Expand Down
6 changes: 3 additions & 3 deletions iocore/net/SSLConfig.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ SslConfigParams::initialize()
else { else {
// XXX: private_key.filename is relative to prefix or sysconfdir? // XXX: private_key.filename is relative to prefix or sysconfdir?
// //
serverKeyPathOnly = xstrdup(Layout::get()->prefix); serverKeyPathOnly = ats_strdup(Layout::get()->prefix);
} }
if (ssl_server_private_key_filename != NULL) { if (ssl_server_private_key_filename != NULL) {
serverKeyPath = Layout::relative_to(serverKeyPathOnly, ssl_server_private_key_filename); serverKeyPath = Layout::relative_to(serverKeyPathOnly, ssl_server_private_key_filename);
Expand Down Expand Up @@ -394,7 +394,7 @@ SslConfigParams::initialize()
IOCORE_ReadConfigStringAlloc(ssl_client_cert_path, "proxy.config.ssl.client.cert.path"); IOCORE_ReadConfigStringAlloc(ssl_client_cert_path, "proxy.config.ssl.client.cert.path");


if (ssl_client_cert_path == NULL) { if (ssl_client_cert_path == NULL) {
ssl_client_cert_path = xstrdup(Layout::get()->prefix); ssl_client_cert_path = ats_strdup(Layout::get()->prefix);
} }
if (ssl_client_cert_filename != NULL) { if (ssl_client_cert_filename != NULL) {
char *abs_path = Layout::get()->relative(ssl_client_cert_path); char *abs_path = Layout::get()->relative(ssl_client_cert_path);
Expand All @@ -420,7 +420,7 @@ SslConfigParams::initialize()
IOCORE_ReadConfigStringAlloc(ssl_client_private_key_path, "proxy.config.ssl.client.private_key.path"); IOCORE_ReadConfigStringAlloc(ssl_client_private_key_path, "proxy.config.ssl.client.private_key.path");


if (ssl_client_private_key_path == NULL) { if (ssl_client_private_key_path == NULL) {
ssl_client_private_key_path = xstrdup(Layout::get()->prefix); ssl_client_private_key_path = ats_strdup(Layout::get()->prefix);
} }


if (ssl_client_private_key_filename != NULL) { if (ssl_client_private_key_filename != NULL) {
Expand Down
4 changes: 2 additions & 2 deletions iocore/net/UnixNetPages.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
} else if (STREQ_PREFIX(path, path_len, "ips")) { } else if (STREQ_PREFIX(path, path_len, "ips")) {
int query_len; int query_len;
const char *query = h->url_get()->query_get(&query_len); const char *query = h->url_get()->query_get(&query_len);
s->sarg = xstrndup(query, query_len); s->sarg = ats_strndup(query, query_len);
char *gn = NULL; char *gn = NULL;
if (s->sarg) if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg)); gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
Expand All @@ -237,7 +237,7 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
} else if (STREQ_PREFIX(path, path_len, "ports")) { } else if (STREQ_PREFIX(path, path_len, "ports")) {
int query_len; int query_len;
const char *query = h->url_get()->query_get(&query_len); const char *query = h->url_get()->query_get(&query_len);
s->sarg = xstrndup(query, query_len); s->sarg = ats_strndup(query, query_len);
char *gn = NULL; char *gn = NULL;
if (s->sarg) if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg)); gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
Expand Down
4 changes: 2 additions & 2 deletions iocore/utils/Machine.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Machine::Machine(char *ahostname, unsigned int aip)
ink_release_assert(!gethostname(localhost, 1023)); ink_release_assert(!gethostname(localhost, 1023));
ahostname = localhost; ahostname = localhost;
} }
hostname = xstrdup(ahostname); hostname = ats_strdup(ahostname);


ink_gethostbyname_r_data data; ink_gethostbyname_r_data data;
struct hostent *r = ink_gethostbyname_r(ahostname, &data); struct hostent *r = ink_gethostbyname_r(ahostname, &data);
Expand Down Expand Up @@ -102,7 +102,7 @@ Machine::Machine(char *ahostname, unsigned int aip)
*(uint32_t *) & x = (uint32_t) ip; *(uint32_t *) & x = (uint32_t) ip;
Debug("machine_debug", "unable to reverse DNS %hhu.%hhu.%hhu.%hhu: %d", x[0], x[1], x[2], x[3], data.herrno); Debug("machine_debug", "unable to reverse DNS %hhu.%hhu.%hhu.%hhu: %d", x[0], x[1], x[2], x[3], data.herrno);
} else } else
hostname = xstrdup(r->h_name); hostname = ats_strdup(r->h_name);
} }


if (hostname) if (hostname)
Expand Down
10 changes: 5 additions & 5 deletions lib/records/P_RecCore.i
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ RecSetRecord(RecT rec_type, const char *name, RecDataT data_type, RecData *data,
} }
rec_mutex_release(&(r1->lock)); rec_mutex_release(&(r1->lock));
} else { } else {
// We don't need to xstrdup() here as we will make copies of any // We don't need to ats_strdup() here as we will make copies of any
// strings when we marshal them into our RecMessage buffer. // strings when we marshal them into our RecMessage buffer.
RecRecord r2; RecRecord r2;
memset(&r2, 0, sizeof(RecRecord)); memset(&r2, 0, sizeof(RecRecord));
Expand Down Expand Up @@ -665,7 +665,7 @@ RecReadConfigFile()
line = line_tok.iterFirst(&line_tok_state); line = line_tok.iterFirst(&line_tok_state);
line_num = 1; line_num = 1;
while (line) { while (line) {
char *lc = xstrdup(line); char *lc = ats_strdup(line);
char *lt = lc; char *lt = lc;
char *ln; char *ln;


Expand Down Expand Up @@ -752,7 +752,7 @@ RecReadConfigFile()
// update our g_rec_config_contents_xxx // update our g_rec_config_contents_xxx
cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry)); cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
cfe->entry_type = RECE_RECORD; cfe->entry_type = RECE_RECORD;
cfe->entry = xstrdup(name_str); cfe->entry = ats_strdup(name_str);
enqueue(g_rec_config_contents_llq, (void *) cfe); enqueue(g_rec_config_contents_llq, (void *) cfe);
ink_hash_table_insert(g_rec_config_contents_ht, name_str, NULL); ink_hash_table_insert(g_rec_config_contents_ht, name_str, NULL);
goto L_done; goto L_done;
Expand All @@ -762,7 +762,7 @@ RecReadConfigFile()
// write it out later // write it out later
cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry)); cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
cfe->entry_type = RECE_COMMENT; cfe->entry_type = RECE_COMMENT;
cfe->entry = xstrdup(line); cfe->entry = ats_strdup(line);
enqueue(g_rec_config_contents_llq, (void *) cfe); enqueue(g_rec_config_contents_llq, (void *) cfe);


L_done: L_done:
Expand Down Expand Up @@ -808,7 +808,7 @@ RecSyncConfigToTB(textBuffer * tb)
if (!ink_hash_table_isbound(g_rec_config_contents_ht, r->name)) { if (!ink_hash_table_isbound(g_rec_config_contents_ht, r->name)) {
cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry)); cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
cfe->entry_type = RECE_RECORD; cfe->entry_type = RECE_RECORD;
cfe->entry = xstrdup(r->name); cfe->entry = ats_strdup(r->name);
enqueue(g_rec_config_contents_llq, (void *) cfe); enqueue(g_rec_config_contents_llq, (void *) cfe);
ink_hash_table_insert(g_rec_config_contents_ht, r->name, NULL); ink_hash_table_insert(g_rec_config_contents_ht, r->name, NULL);
} }
Expand Down
4 changes: 2 additions & 2 deletions lib/records/RecCore.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type,
if (r->config_meta.check_expr) { if (r->config_meta.check_expr) {
ats_free(r->config_meta.check_expr); ats_free(r->config_meta.check_expr);
} }
r->config_meta.check_expr = xstrdup(check_expr); r->config_meta.check_expr = ats_strdup(check_expr);
r->config_meta.update_cb_list = NULL; r->config_meta.update_cb_list = NULL;
r->config_meta.access_type = access_type; r->config_meta.access_type = access_type;
rec_mutex_release(&(r->lock)); rec_mutex_release(&(r->lock));
Expand Down Expand Up @@ -847,7 +847,7 @@ RecForceInsert(RecRecord * record)
r->config_meta.update_type = record->config_meta.update_type; r->config_meta.update_type = record->config_meta.update_type;
r->config_meta.check_type = record->config_meta.check_type; r->config_meta.check_type = record->config_meta.check_type;
ats_free(r->config_meta.check_expr); ats_free(r->config_meta.check_expr);
r->config_meta.check_expr = xstrdup(record->config_meta.check_expr); r->config_meta.check_expr = ats_strdup(record->config_meta.check_expr);
r->config_meta.access_type = record->config_meta.access_type; r->config_meta.access_type = record->config_meta.access_type;
} }


Expand Down
4 changes: 2 additions & 2 deletions lib/records/RecTree.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ var_name_ptr(NULL),
num_leaf(0) num_leaf(0)
{ {
if (t) { if (t) {
node_name = xstrdup(t); node_name = ats_strdup(t);
} else { } else {
node_name = xstrdup("root"); node_name = ats_strdup("root");
} }
} }


Expand Down
8 changes: 4 additions & 4 deletions lib/records/RecUtils.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RecAlloc(RecT rec_type, const char *name, RecDataT data_type)
RecRecord *r = &(g_records[i]); RecRecord *r = &(g_records[i]);
// Note: record should already be memset to 0 from RecCoreInit() // Note: record should already be memset to 0 from RecCoreInit()
r->rec_type = rec_type; r->rec_type = rec_type;
r->name = xstrdup(name); r->name = ats_strdup(name);
r->order = i; r->order = i;
r->data_type = data_type; r->data_type = data_type;
rec_mutex_init(&(r->lock), NULL); rec_mutex_init(&(r->lock), NULL);
Expand Down Expand Up @@ -87,7 +87,7 @@ RecDataSet(RecDataT data_type, RecData * data_dst, RecData * data_src)
} else if (((data_dst->rec_string) && (strcmp(data_dst->rec_string, data_src->rec_string) != 0)) || } else if (((data_dst->rec_string) && (strcmp(data_dst->rec_string, data_src->rec_string) != 0)) ||
((data_dst->rec_string == NULL) && (data_src->rec_string != NULL))) { ((data_dst->rec_string == NULL) && (data_src->rec_string != NULL))) {
ats_free(data_dst->rec_string); ats_free(data_dst->rec_string);
data_dst->rec_string = xstrdup(data_src->rec_string); data_dst->rec_string = ats_strdup(data_src->rec_string);
rec_set = true; rec_set = true;
} }
break; break;
Expand Down Expand Up @@ -136,7 +136,7 @@ RecDataSetFromInk64(RecDataT data_type, RecData * data_dst, int64_t data_int64)


ats_free(data_dst->rec_string); ats_free(data_dst->rec_string);
snprintf(buf, 32, "%" PRId64 "", data_int64); snprintf(buf, 32, "%" PRId64 "", data_int64);
data_dst->rec_string = xstrdup(buf); data_dst->rec_string = ats_strdup(buf);
break; break;
} }
case RECD_COUNTER: case RECD_COUNTER:
Expand Down Expand Up @@ -170,7 +170,7 @@ RecDataSetFromFloat(RecDataT data_type, RecData * data_dst, float data_float)


ats_free(data_dst->rec_string); ats_free(data_dst->rec_string);
snprintf(buf, 32, "%f", data_float); snprintf(buf, 32, "%f", data_float);
data_dst->rec_string = xstrdup(buf); data_dst->rec_string = ats_strdup(buf);
break; break;
} }
case RECD_COUNTER: case RECD_COUNTER:
Expand Down
4 changes: 2 additions & 2 deletions lib/ts/Diags.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ diags_log_fp(_diags_log_fp), show_location(0)
base_debug_tags = NULL; base_debug_tags = NULL;
base_action_tags = NULL; base_action_tags = NULL;
if (bdt && *bdt) { if (bdt && *bdt) {
base_debug_tags = xstrdup(bdt); base_debug_tags = ats_strdup(bdt);
} }
if (bat && *bat) { if (bat && *bat) {
base_action_tags = xstrdup(bat); base_action_tags = ats_strdup(bat);
} }


config.enabled[DiagsTagType_Debug] = (base_debug_tags != NULL); config.enabled[DiagsTagType_Debug] = (base_debug_tags != NULL);
Expand Down
Loading

0 comments on commit 51a214f

Please sign in to comment.