Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

TS-567 Change xstrdup/xstrndup to ats_strdup/ats_strndup

git-svn-id: https://svn.apache.org/repos/asf/trafficserver/traffic/trunk@1166456 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 51a214fa271d48b4adf8f49584676b8473b31b0f 1 parent f2088d3
@zwoop zwoop authored
Showing with 437 additions and 448 deletions.
  1. +1 −1  cop/TrafficCop.cc
  2. +1 −1  iocore/cache/Cache.cc
  3. +1 −1  iocore/cache/CacheDisk.cc
  4. +1 −1  iocore/cache/CacheHosting.cc
  5. +9 −9 iocore/cache/Store.cc
  6. +5 −5 iocore/cluster/ClusterMachine.cc
  7. +1 −1  iocore/cluster/ClusterProcessor.cc
  8. +1 −1  iocore/dns/DNS.cc
  9. +1 −1  iocore/dns/P_SplitDNSProcessor.h
  10. +2 −2 iocore/hostdb/HostDB.cc
  11. +3 −3 iocore/net/SSLConfig.cc
  12. +2 −2 iocore/net/UnixNetPages.cc
  13. +2 −2 iocore/utils/Machine.cc
  14. +5 −5 lib/records/P_RecCore.i
  15. +2 −2 lib/records/RecCore.cc
  16. +2 −2 lib/records/RecTree.cc
  17. +4 −4 lib/records/RecUtils.cc
  18. +2 −2 lib/ts/Diags.cc
  19. +4 −4 lib/ts/HostLookup.cc
  20. +3 −3 lib/ts/Layout.cc
  21. +1 −1  lib/ts/SimpleTokenizer.h
  22. +1 −1  lib/ts/ink_hash_table.cc
  23. +3 −0  lib/ts/ink_memory.h
  24. +5 −11 lib/ts/ink_resource.cc
  25. +0 −5 lib/ts/ink_resource.h
  26. +1 −1  mgmt/FileManager.cc
  27. +1 −1  mgmt/LocalManager.cc
  28. +43 −43 mgmt/api/CfgContextImpl.cc
  29. +1 −1  mgmt/api/CfgContextManager.cc
  30. +98 −98 mgmt/api/CfgContextUtils.cc
  31. +6 −6 mgmt/api/CoreAPI.cc
  32. +1 −1  mgmt/api/CoreAPIShared.cc
  33. +3 −3 mgmt/api/EventControlMain.cc
  34. +11 −11 mgmt/api/GenericParser.cc
  35. +17 −17 mgmt/api/INKMgmtAPI.cc
  36. +8 −8 mgmt/api/remote/APITestCliRemote.cc
  37. +3 −3 mgmt/api/remote/CoreAPIRemote.cc
  38. +4 −4 mgmt/cli/cliParseArg.cc
  39. +3 −3 mgmt/cli/createArgument.cc
  40. +1 −1  mgmt/cluster/VMap.cc
  41. +3 −3 mgmt/stats/StatType.cc
  42. +2 −2 mgmt/tools/ConfigAPI.cc
  43. +4 −4 mgmt/tools/SysAPI.cc
  44. +7 −7 mgmt/utils/WebMgmtUtils.cc
  45. +6 −6 mgmt/web2/WebHttpMessage.cc
  46. +1 −1  mgmt/web2/WebIntrMain.cc
  47. +5 −5 mgmt/web2/WebOverview.cc
  48. +4 −4 proxy/ControlBase.cc
  49. +3 −3 proxy/ControlMatcher.cc
  50. +3 −3 proxy/CoreUtils.cc
  51. +1 −1  proxy/IPAllow.cc
  52. +5 −5 proxy/InkAPI.cc
  53. +2 −2 proxy/InkAPITestTool.cc
  54. +4 −4 proxy/InkXml.cc
  55. +1 −1  proxy/Plugin.cc
  56. +5 −5 proxy/Prefetch.cc
  57. +3 −3 proxy/Update.cc
  58. +6 −6 proxy/congest/Congestion.cc
  59. +1 −1  proxy/hdrs/load_http_hdr.cc
  60. +7 −7 proxy/http/HttpBodyFactory.cc
  61. +29 −31 proxy/http/HttpConfig.cc
  62. +2 −2 proxy/http/remap/AclFiltering.cc
  63. +1 −1  proxy/http/remap/RemapPluginInfo.cc
  64. +4 −4 proxy/http/remap/RemapProcessor.cc
  65. +2 −2 proxy/http/remap/UrlMapping.cc
  66. +10 −10 proxy/http/remap/UrlRewrite.cc
  67. +1 −1  proxy/logging/LogAccess.cc
  68. +1 −1  proxy/logging/LogBuffer.cc
  69. +15 −15 proxy/logging/LogConfig.cc
  70. +4 −4 proxy/logging/LogField.cc
  71. +1 −1  proxy/logging/LogFieldAliasMap.cc
  72. +9 −10 proxy/logging/LogFile.cc
  73. +2 −2 proxy/logging/LogFilter.cc
  74. +9 −9 proxy/logging/LogFormat.cc
  75. +7 −7 proxy/logging/LogHost.cc
  76. +1 −1  proxy/logging/LogObject.cc
  77. +3 −3 proxy/logstats.cc
View
2  cop/TrafficCop.cc
@@ -510,7 +510,7 @@ build_config_table(FILE * fp)
}
varname[i] = '\0';
- ink_hash_table_insert(configTable, varname, xstrdup(buffer));
+ ink_hash_table_insert(configTable, varname, ats_strdup(buffer));
}
#ifdef TRACE_LOG_COP
cop_log(COP_DEBUG, "Leaving build_config_table(%d)\n", fp);
View
2  iocore/cache/Cache.cc
@@ -1030,7 +1030,7 @@ int
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));
- path = xstrdup(s);
+ path = ats_strdup(s);
const size_t hash_id_size = strlen(s) + 32;
hash_id = (char *)ats_malloc(hash_id_size);
ink_strncpy(hash_id, s, hash_id_size);
View
2  iocore/cache/CacheDisk.cc
@@ -27,7 +27,7 @@
int
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;
fd = fildes;
skip = askip;
View
2  iocore/cache/CacheHosting.cc
@@ -504,7 +504,7 @@ CacheHostRecord::Init(matcher_line * line_info, int typ)
if (!strcasecmp(label, "volume")) {
/* 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 *s = val;
int volume_number;
View
18 iocore/cache/Store.cc
@@ -529,7 +529,7 @@ Span::init(char *an, int64_t size)
disk_id = devnum;
}
- pathname = xstrdup(an);
+ pathname = ats_strdup(an);
blocks = size / STORE_BLOCK_SIZE;
file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR);
@@ -624,7 +624,7 @@ Span::init(char *filename, int64_t size)
disk_id = devnum;
}
- pathname = xstrdup(filename);
+ pathname = ats_strdup(filename);
// is this right Seems like this should be size / hw_sector_size
blocks = size / STORE_BLOCK_SIZE;
file_pathname = !((s.st_mode & S_IFMT) == S_IFDIR);
@@ -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 "",
physsectors, hw_sector_size * (int64_t)physsectors, size, blocks);
- pathname = xstrdup(filename);
+ pathname = ats_strdup(filename);
file_pathname = 1;
} else {
Debug("cache_init", "Span::init - is_disk = %d, raw device = %s", is_disk, (major(devnum) == 162) ? "yes" : "no");
@@ -767,7 +767,7 @@ Span::init(char *filename, int64_t size)
is_disk = 1;
is_mmapable_internal = false; /* I -think- */
file_pathname = 1;
- pathname = xstrdup(filename);
+ pathname = ats_strdup(filename);
isRaw = 1;
if (size <= 0)
@@ -780,7 +780,7 @@ Span::init(char *filename, int64_t size)
* don't particularly understand that behaviour, so I'll just ignore it.
* :) */
- pathname = xstrdup(filename);
+ pathname = ats_strdup(filename);
if (!file_pathname)
if (size <= 0)
return "When using directories for cache storage, you must specify a size\n";
@@ -823,7 +823,7 @@ try_alloc(Store & target, Span * source, unsigned int start_blocks, bool one_onl
a = blocks;
Span *d = NEW(new Span(*source));
- d->pathname = xstrdup(source->pathname);
+ d->pathname = ats_strdup(source->pathname);
d->blocks = a;
d->file_pathname = source->file_pathname;
d->offset = source->offset;
@@ -899,7 +899,7 @@ Store::try_realloc(Store & s, Store & diff)
goto Lfound;
} else {
Span *x = NEW(new Span(*d));
- x->pathname = xstrdup(x->pathname);
+ x->pathname = ats_strdup(x->pathname);
// d will be the first vol
d->blocks = sd->offset - d->offset;
d->link.next = x;
@@ -1021,7 +1021,7 @@ Span::read(int fd)
if (sscanf(buf, "%s", p) != 1) {
return (-1);
}
- pathname = xstrdup(p);
+ pathname = ats_strdup(p);
if (get_int64(fd, blocks) < 0) {
return -1;
}
@@ -1120,7 +1120,7 @@ Span *
Span::dup()
{
Span *ds = NEW(new Span(*this));
- ds->pathname = xstrdup(pathname);
+ ds->pathname = ats_strdup(pathname);
if (ds->link.next)
ds->link.next = ds->link.next->dup();
return ds;
View
10 iocore/cluster/ClusterMachine.cc
@@ -83,7 +83,7 @@ clusterHandler(0)
ink_release_assert(!gethostname(localhost, 1023));
ahostname = localhost;
}
- hostname = xstrdup(ahostname);
+ hostname = ats_strdup(ahostname);
// If we are running if the manager, it the our ip address for
// clustering from the manager, so the manager can control what
@@ -135,7 +135,7 @@ clusterHandler(0)
*(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);
} else
- hostname = xstrdup(r->h_name);
+ hostname = ats_strdup(r->h_name);
}
if (hostname)
hostname_len = strlen(hostname);
@@ -230,7 +230,7 @@ read_MachineList(char *filename, int afd)
} else {
char s[256];
snprintf(s, sizeof s, "bad ip, line %d", ln);
- return (MachineList *) xstrdup(s);
+ return (MachineList *) ats_strdup(s);
}
}
l->machine[i].port = atoi(port);
@@ -246,7 +246,7 @@ read_MachineList(char *filename, int afd)
} else {
char s[256];
snprintf(s, sizeof s, "bad port, line %d", ln);
- return (MachineList *) xstrdup(s);
+ return (MachineList *) ats_strdup(s);
}
}
}
@@ -262,7 +262,7 @@ read_MachineList(char *filename, int afd)
return NULL;
} else
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;
View
2  iocore/cluster/ClusterProcessor.cc
@@ -756,7 +756,7 @@ ClusterProcessor::connect(char *hostname)
//
ClusterHandler *ch = NEW(new ClusterHandler);
SET_CONTINUATION_HANDLER(ch, (ClusterContHandler) & ClusterHandler::connectClusterEvent);
- ch->hostname = xstrdup(hostname);
+ ch->hostname = ats_strdup(hostname);
ch->connector = true;
eventProcessor.schedule_imm(ch, ET_CLUSTER);
}
View
2  iocore/dns/DNS.cc
@@ -258,7 +258,7 @@ DNSProcessor::dns_init()
Debug("dns", "Nameserver list specified \"%s\"\n", dns_ns_list);
int i;
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);
for (i = 0, nserv = 0 ; (i < MAX_NAMED) && ns ; ++i) {
View
2  iocore/dns/P_SplitDNSProcessor.h
@@ -219,7 +219,7 @@ TS_INLINE DNSRequestData::DNSRequestData()
TS_INLINE char *
DNSRequestData::get_string()
{
- return xstrdup((char *) m_pHost);
+ return ats_strdup((char *) m_pHost);
}
View
4 iocore/hostdb/HostDB.cc
@@ -2241,7 +2241,7 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
s->force = !ptr_len_ncasecmp(path + 3, path_len - 3, "force", 5);
int 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;
if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
@@ -2253,7 +2253,7 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
s->force = !ptr_len_ncasecmp(path + 5, path_len - 5, "force", 5);
int 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;
if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
View
6 iocore/net/SSLConfig.cc
@@ -338,7 +338,7 @@ SslConfigParams::initialize()
else {
// 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) {
serverKeyPath = Layout::relative_to(serverKeyPathOnly, ssl_server_private_key_filename);
@@ -394,7 +394,7 @@ SslConfigParams::initialize()
IOCORE_ReadConfigStringAlloc(ssl_client_cert_path, "proxy.config.ssl.client.cert.path");
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) {
char *abs_path = Layout::get()->relative(ssl_client_cert_path);
@@ -420,7 +420,7 @@ SslConfigParams::initialize()
IOCORE_ReadConfigStringAlloc(ssl_client_private_key_path, "proxy.config.ssl.client.private_key.path");
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) {
View
4 iocore/net/UnixNetPages.cc
@@ -227,7 +227,7 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
} else if (STREQ_PREFIX(path, path_len, "ips")) {
int 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;
if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
@@ -237,7 +237,7 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
} else if (STREQ_PREFIX(path, path_len, "ports")) {
int 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;
if (s->sarg)
gn = (char *)memchr(s->sarg, '=', strlen(s->sarg));
View
4 iocore/utils/Machine.cc
@@ -71,7 +71,7 @@ Machine::Machine(char *ahostname, unsigned int aip)
ink_release_assert(!gethostname(localhost, 1023));
ahostname = localhost;
}
- hostname = xstrdup(ahostname);
+ hostname = ats_strdup(ahostname);
ink_gethostbyname_r_data data;
struct hostent *r = ink_gethostbyname_r(ahostname, &data);
@@ -102,7 +102,7 @@ Machine::Machine(char *ahostname, unsigned int aip)
*(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);
} else
- hostname = xstrdup(r->h_name);
+ hostname = ats_strdup(r->h_name);
}
if (hostname)
View
10 lib/records/P_RecCore.i
@@ -461,7 +461,7 @@ RecSetRecord(RecT rec_type, const char *name, RecDataT data_type, RecData *data,
}
rec_mutex_release(&(r1->lock));
} 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.
RecRecord r2;
memset(&r2, 0, sizeof(RecRecord));
@@ -665,7 +665,7 @@ RecReadConfigFile()
line = line_tok.iterFirst(&line_tok_state);
line_num = 1;
while (line) {
- char *lc = xstrdup(line);
+ char *lc = ats_strdup(line);
char *lt = lc;
char *ln;
@@ -752,7 +752,7 @@ RecReadConfigFile()
// update our g_rec_config_contents_xxx
cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
cfe->entry_type = RECE_RECORD;
- cfe->entry = xstrdup(name_str);
+ cfe->entry = ats_strdup(name_str);
enqueue(g_rec_config_contents_llq, (void *) cfe);
ink_hash_table_insert(g_rec_config_contents_ht, name_str, NULL);
goto L_done;
@@ -762,7 +762,7 @@ RecReadConfigFile()
// write it out later
cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
cfe->entry_type = RECE_COMMENT;
- cfe->entry = xstrdup(line);
+ cfe->entry = ats_strdup(line);
enqueue(g_rec_config_contents_llq, (void *) cfe);
L_done:
@@ -808,7 +808,7 @@ RecSyncConfigToTB(textBuffer * tb)
if (!ink_hash_table_isbound(g_rec_config_contents_ht, r->name)) {
cfe = (RecConfigFileEntry *)ats_malloc(sizeof(RecConfigFileEntry));
cfe->entry_type = RECE_RECORD;
- cfe->entry = xstrdup(r->name);
+ cfe->entry = ats_strdup(r->name);
enqueue(g_rec_config_contents_llq, (void *) cfe);
ink_hash_table_insert(g_rec_config_contents_ht, r->name, NULL);
}
View
4 lib/records/RecCore.cc
@@ -764,7 +764,7 @@ RecRegisterConfig(RecT rec_type, const char *name, RecDataT data_type,
if (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.access_type = access_type;
rec_mutex_release(&(r->lock));
@@ -847,7 +847,7 @@ RecForceInsert(RecRecord * record)
r->config_meta.update_type = record->config_meta.update_type;
r->config_meta.check_type = record->config_meta.check_type;
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;
}
View
4 lib/records/RecTree.cc
@@ -40,9 +40,9 @@ var_name_ptr(NULL),
num_leaf(0)
{
if (t) {
- node_name = xstrdup(t);
+ node_name = ats_strdup(t);
} else {
- node_name = xstrdup("root");
+ node_name = ats_strdup("root");
}
}
View
8 lib/records/RecUtils.cc
@@ -44,7 +44,7 @@ RecAlloc(RecT rec_type, const char *name, RecDataT data_type)
RecRecord *r = &(g_records[i]);
// Note: record should already be memset to 0 from RecCoreInit()
r->rec_type = rec_type;
- r->name = xstrdup(name);
+ r->name = ats_strdup(name);
r->order = i;
r->data_type = data_type;
rec_mutex_init(&(r->lock), NULL);
@@ -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)) ||
((data_dst->rec_string == NULL) && (data_src->rec_string != NULL))) {
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;
}
break;
@@ -136,7 +136,7 @@ RecDataSetFromInk64(RecDataT data_type, RecData * data_dst, int64_t data_int64)
ats_free(data_dst->rec_string);
snprintf(buf, 32, "%" PRId64 "", data_int64);
- data_dst->rec_string = xstrdup(buf);
+ data_dst->rec_string = ats_strdup(buf);
break;
}
case RECD_COUNTER:
@@ -170,7 +170,7 @@ RecDataSetFromFloat(RecDataT data_type, RecData * data_dst, float data_float)
ats_free(data_dst->rec_string);
snprintf(buf, 32, "%f", data_float);
- data_dst->rec_string = xstrdup(buf);
+ data_dst->rec_string = ats_strdup(buf);
break;
}
case RECD_COUNTER:
View
4 lib/ts/Diags.cc
@@ -115,10 +115,10 @@ diags_log_fp(_diags_log_fp), show_location(0)
base_debug_tags = NULL;
base_action_tags = NULL;
if (bdt && *bdt) {
- base_debug_tags = xstrdup(bdt);
+ base_debug_tags = ats_strdup(bdt);
}
if (bat && *bat) {
- base_action_tags = xstrdup(bat);
+ base_action_tags = ats_strdup(bat);
}
config.enabled[DiagsTagType_Debug] = (base_debug_tags != NULL);
View
8 lib/ts/HostLookup.cc
@@ -622,7 +622,7 @@ hostArray::Insert(const char *match_data_in, HostBranch * toInsert)
return false;
} else {
branch_array[num_el] = toInsert;
- match_data[num_el] = xstrdup(match_data_in);
+ match_data[num_el] = ats_strdup(match_data_in);
num_el++;
return true;
}
@@ -1045,7 +1045,7 @@ HostLookup::TableInsert(const char *match_data, int index, bool domain_record)
{
HostBranch *cur = this->root;
HostBranch *next;
- char *match_copy = xstrdup(match_data);
+ char *match_copy = ats_strdup(match_data);
Tokenizer match_tok(".");
int numTok;
int i;
@@ -1186,7 +1186,7 @@ HostLookup::MatchFirst(const char *host, HostLookupState * s, void **opaque_ptr)
s->table_level = 0;
s->array_index = -1;
s->hostname = host ? host : "";
- s->host_copy = xstrdup(s->hostname);
+ s->host_copy = ats_strdup(s->hostname);
LowerCaseStr(s->host_copy);
// Find the top level domain in the host copy
@@ -1314,7 +1314,7 @@ HostLookup::NewEntry(const char *match_data, bool domain_record, void *opaque_da
// Make sure we do not overrun the array;
ink_assert(num_el < array_len);
- leaf_array[num_el].match = xstrdup(match_data);
+ leaf_array[num_el].match = ats_strdup(match_data);
leaf_array[num_el].opaque_data = opaque_data_in;
if ('!' != *(leaf_array[num_el].match)) {
View
6 lib/ts/Layout.cc
@@ -63,7 +63,7 @@ layout_relative(const char *root, const char *file)
}
return NULL;
}
- return xstrdup(path);
+ return ats_strdup(path);
}
char *
@@ -141,7 +141,7 @@ Layout::relative_to(char *buf, size_t bufsz, const char *dir, const char *file)
Layout::Layout(const char *_prefix)
{
if (_prefix) {
- prefix = xstrdup(_prefix);
+ prefix = ats_strdup(_prefix);
} else {
char *env_path;
char path[PATH_MAX];
@@ -169,7 +169,7 @@ Layout::Layout(const char *_prefix)
path, errno, strerror(errno));
return;
}
- prefix = xstrdup(path);
+ prefix = ats_strdup(path);
}
exec_prefix = layout_relative(prefix, TS_BUILD_EXEC_PREFIX);
bindir = layout_relative(prefix, TS_BUILD_BINDIR);
View
2  lib/ts/SimpleTokenizer.h
@@ -147,7 +147,7 @@ SimpleTokenizer(char *s, char delimiter = ' ', int mode = 0, char escape = '\\')
_start = 0;
_length = strlen(s);
- _data = (_mode & OVERWRITE_INPUT_STRING ? s : xstrdup(s));
+ _data = (_mode & OVERWRITE_INPUT_STRING ? s : ats_strdup(s));
// to handle the case where there is a null field at the end of the
// input string, we replace the null character at the end of the
View
2  lib/ts/ink_hash_table.cc
@@ -457,5 +457,5 @@ ink_hash_table_replace_string(InkHashTable * ht_ptr, char *string_key, char *str
ats_free(old_str);
}
- ink_hash_table_set_entry(ht_ptr, he_ptr, (InkHashTableValue)(xstrdup(string_value)));
+ ink_hash_table_set_entry(ht_ptr, he_ptr, (InkHashTableValue)(ats_strdup(string_value)));
} /* End ink_hash_table_replace_string */
View
3  lib/ts/ink_memory.h
@@ -38,6 +38,9 @@ extern "C"
void* ats_free_null(void *ptr);
void ats_memalign_free(void *ptr);
+#define ats_strdup(p) _xstrdup((p), -1, NULL)
+#define ats_strndup(p,n) _xstrdup((p), n, NULL)
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
View
16 lib/ts/ink_resource.cc
@@ -40,19 +40,13 @@ _xstrdup(const char *str, int length, const char *path)
char *newstr;
if (likely(str)) {
- if (length < 0) {
+ if (length < 0)
length = strlen(str);
- }
- // TODO: TS-567 shouldn't have to check the return value here.
+
newstr = (char *)ats_malloc(length + 1);
- if (likely(newstr != NULL)) {
- strncpy(newstr, str, length);
- newstr[length] = '\0';
- return newstr;
- }
- fprintf(stderr, "FATAL: could not allocate %d bytes in _xstrdup\n", length + 1);
- ink_stack_trace_dump();
- _exit(1);
+ strncpy(newstr, str, length);
+ newstr[length] = '\0';
+ return newstr;
}
return NULL;
}
View
5 lib/ts/ink_resource.h
@@ -53,12 +53,7 @@ struct Resource
// with jemalloc / tcmalloc's features of enabling memory debugging.
#define RES_TRACK_MEMORY_DEFAULT 0 /* default value for res_track_memory variable */
-
-#define xstrdup(p) _xstrdup ((p), -1, NULL)
-#define xstrndup(p,n) _xstrdup ((p), n, NULL)
-
char *_xstrdup(const char *str, int length, const char *path);
-
void xdump(void);
#if defined(__cplusplus)
View
2  mgmt/FileManager.cc
@@ -249,7 +249,7 @@ FileManager::fileChanged(const char *baseFileName)
for (cb = cblist.head; cb != NULL; cb = cb->link.next) {
// Dup the string for each callback to be
// defensive incase it modified when it is not supposed to be
- filenameCopy = xstrdup(baseFileName);
+ filenameCopy = ats_strdup(baseFileName);
(*cb->func) (filenameCopy);
ats_free(filenameCopy);
}
View
2  mgmt/LocalManager.cc
@@ -314,7 +314,7 @@ LocalManager::LocalManager(char *mpath, bool proxy_on)
char *absolute_config_path = Layout::get()->relative(config_path);
ats_free(config_path);
if (access(absolute_config_path, R_OK) == -1) {
- config_path = xstrdup(system_config_directory);
+ config_path = ats_strdup(system_config_directory);
if (access(config_path, R_OK) == -1) {
mgmt_elog("[LocalManager::LocalManager] unable to access() directory '%s': %d, %s\n",
config_path, errno, strerror(errno));
View
86 mgmt/api/CfgContextImpl.cc
@@ -57,7 +57,7 @@ CommentObj::~CommentObj()
char *
CommentObj::formatEleToRule()
{
- return xstrdup(m_ele->comment);
+ return ats_strdup(m_ele->comment);
}
bool CommentObj::isValid()
@@ -199,7 +199,7 @@ CacheObj::formatEleToRule()
break;
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool CacheObj::isValid()
@@ -290,7 +290,7 @@ CongestionObj::CongestionObj(TokenList * tokens)
} else if (strcmp(tok->name, "host_regex") == 0) {
m_ele->pd_type = TS_PD_URL_REGEX;
}
- m_ele->pd_val = xstrdup(tok->value);
+ m_ele->pd_val = ats_strdup(tok->value);
// check for remaining tags
tok = tokens->next(tok);
@@ -299,7 +299,7 @@ CongestionObj::CongestionObj(TokenList * tokens)
goto FORMAT_ERR;
}
if (strcmp(tok->name, "prefix") == 0) {
- m_ele->prefix = xstrdup(tok->value);
+ m_ele->prefix = ats_strdup(tok->value);
} else if (strcmp(tok->name, "port") == 0) {
m_ele->port = ink_atoi(tok->value);
} else if (strcmp(tok->name, "congestion_scheme") == 0) {
@@ -331,7 +331,7 @@ CongestionObj::CongestionObj(TokenList * tokens)
} else if (strcmp(tok->name, "max_connection") == 0) {
m_ele->max_connection = ink_atoi(tok->value);
} else if (strcmp(tok->name, "error_page_uri") == 0) {
- m_ele->error_page_uri = xstrdup(tok->value);
+ m_ele->error_page_uri = ats_strdup(tok->value);
} else {
goto FORMAT_ERR;
}
@@ -449,7 +449,7 @@ CongestionObj::formatEleToRule()
;
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool CongestionObj::isValid()
@@ -511,7 +511,7 @@ HostingObj::HostingObj(TokenList * tokens)
} else {
goto FORMAT_ERR;
}
- m_ele->pd_val = xstrdup(token->value);
+ m_ele->pd_val = ats_strdup(token->value);
// Second Token
token = tokens->next(token);
@@ -566,7 +566,7 @@ HostingObj::formatEleToRule()
strncat(buf, list_str, sizeof(buf) - strlen(buf) - 1);
ats_free(list_str);
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool HostingObj::isValid()
@@ -659,7 +659,7 @@ IcpObj::IcpObj(TokenList * tokens)
switch (i) {
case 0:
if (strlen(alias) > 0)
- m_ele->peer_hostname = xstrdup(alias);
+ m_ele->peer_hostname = ats_strdup(alias);
break;
case 1:
if (strlen(alias) > 0) {
@@ -768,13 +768,13 @@ IcpObj::formatEleToRule()
if (m_ele->peer_host_ip_addr)
ip_str1 = ip_addr_to_string(m_ele->peer_host_ip_addr);
else
- ip_str1 = xstrdup("");
+ ip_str1 = ats_strdup("");
// optional field
if (m_ele->mc_ip_addr)
ip_str2 = ip_addr_to_string(m_ele->mc_ip_addr);
else
- ip_str2 = xstrdup("0.0.0.0");
+ ip_str2 = ats_strdup("0.0.0.0");
if (m_ele->peer_hostname) {
snprintf(buf, sizeof(buf), "%s:%s:%d:%d:%d:%d:%s:",
@@ -800,7 +800,7 @@ IcpObj::formatEleToRule()
ats_free(ip_str1);
ats_free(ip_str2);
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool IcpObj::isValid()
@@ -950,7 +950,7 @@ IpAllowObj::formatEleToRule()
break;
}
- rule = xstrdup(buf);
+ rule = ats_strdup(buf);
return rule;
}
@@ -1153,7 +1153,7 @@ ParentProxyObj::formatEleToRule()
strncat(buf, "go_direct=false", sizeof(buf) - strlen(buf) - 1);
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool ParentProxyObj::isValid()
@@ -1284,7 +1284,7 @@ VolumeObj::formatEleToRule()
break;
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool VolumeObj::isValid()
@@ -1358,7 +1358,7 @@ PluginObj::PluginObj(TokenList * tokens)
if (strcmp(token->name, "") == 0) {
goto FORMAT_ERR;
}
- m_ele->name = xstrdup(token->name);
+ m_ele->name = ats_strdup(token->name);
// arguments
token = tokens->next(token);
@@ -1366,7 +1366,7 @@ PluginObj::PluginObj(TokenList * tokens)
if (m_ele->args == TS_INVALID_LIST)
m_ele->args = TSStringListCreate();
if (token->name)
- TSStringListEnqueue(m_ele->args, xstrdup(token->name));
+ TSStringListEnqueue(m_ele->args, ats_strdup(token->name));
token = tokens->next(token);
}
@@ -1402,7 +1402,7 @@ PluginObj::formatEleToRule()
snprintf(buf, sizeof(buf), "%s", m_ele->name);
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool PluginObj::isValid()
@@ -1478,7 +1478,7 @@ RemapObj::RemapObj(TokenList * tokens)
}
// from host
- m_ele->from_host = xstrdup(fromTok[3]);
+ m_ele->from_host = ats_strdup(fromTok[3]);
current = 4;
if (fromTok[4]) {
@@ -1505,7 +1505,7 @@ RemapObj::RemapObj(TokenList * tokens)
buf[strlen(buf) - 1] = '\0'; // truncate the last '/'
}
- m_ele->from_path_prefix = xstrdup(buf);
+ m_ele->from_path_prefix = ats_strdup(buf);
}
} else {
if ((token->name)[strlen(token->name) - 1] == '/') {
@@ -1513,7 +1513,7 @@ RemapObj::RemapObj(TokenList * tokens)
ink_strncpy(buf, m_ele->from_host, sizeof(buf));
ats_free(m_ele->from_host);
strncat(buf, "/", sizeof(buf) - strlen(buf) - 1);
- m_ele->from_host = xstrdup(buf);
+ m_ele->from_host = ats_strdup(buf);
}
}
@@ -1534,7 +1534,7 @@ RemapObj::RemapObj(TokenList * tokens)
}
// to host
- m_ele->to_host = xstrdup(toTok[3]);
+ m_ele->to_host = ats_strdup(toTok[3]);
current = 4;
if (toTok[4]) {
@@ -1561,7 +1561,7 @@ RemapObj::RemapObj(TokenList * tokens)
buf[strlen(buf) - 1] = '\0'; // truncate the last '/'
}
- m_ele->to_path_prefix = xstrdup(buf);
+ m_ele->to_path_prefix = ats_strdup(buf);
}
} else {
if ((token->value)[strlen(token->value) - 1] == '/') {
@@ -1570,7 +1570,7 @@ RemapObj::RemapObj(TokenList * tokens)
ink_strncpy(buf, m_ele->to_host, sizeof(buf));
ats_free(m_ele->to_host);
strncat(buf, "/", sizeof(buf) - strlen(buf) - 1);
- m_ele->to_host = xstrdup(buf);
+ m_ele->to_host = ats_strdup(buf);
}
}
@@ -1679,7 +1679,7 @@ RemapObj::formatEleToRule()
strncat(buf, m_ele->to_path_prefix, sizeof(buf) - strlen(buf) - 1);
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool RemapObj::isValid()
@@ -1779,13 +1779,13 @@ SocksObj::SocksObj(TokenList * tokens)
if (strcmp(tok->value, "u") == 0) {
tok = tokens->next(tok);
if (tok && tok->name) {
- m_ele->username = xstrdup(tok->name);
+ m_ele->username = ats_strdup(tok->name);
} else {
goto FORMAT_ERR;
}
if (tok && tok->name) {
tok = tokens->next(tok);
- m_ele->password = xstrdup(tok->name);
+ m_ele->password = ats_strdup(tok->name);
} else {
goto FORMAT_ERR;
}
@@ -1913,7 +1913,7 @@ SocksObj::formatEleToRule()
}
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
// the rule must either have an ip addr list (exclusive) OR
@@ -2001,21 +2001,21 @@ SplitDnsObj::SplitDnsObj(TokenList * tokens)
goto FORMAT_ERR;
}
m_ele->pd_type = TS_PD_DOMAIN;
- m_ele->pd_val = xstrdup(tok->value);
+ m_ele->pd_val = ats_strdup(tok->value);
} else if (strcmp(tok->name, "dest_host") == 0) {
if ((m_ele->pd_type != TS_PD_UNDEFINED) || (m_ele->pd_val != NULL) || (!tok->value)) {
// fields are already defined!!
goto FORMAT_ERR;
}
m_ele->pd_type = TS_PD_HOST;
- m_ele->pd_val = xstrdup(tok->value);
+ m_ele->pd_val = ats_strdup(tok->value);
} else if (strcmp(tok->name, "url_regex") == 0) {
if ((m_ele->pd_type != TS_PD_UNDEFINED) || (m_ele->pd_val != NULL) || (!tok->value)) {
// fields are already defined!!
goto FORMAT_ERR;
}
m_ele->pd_type = TS_PD_URL_REGEX;
- m_ele->pd_val = xstrdup(tok->value);
+ m_ele->pd_val = ats_strdup(tok->value);
} else if (strcmp(tok->name, "named") == 0) {
if ((m_ele->dns_servers_addrs != NULL) || (!tok->value)) {
// fields are already defined!!
@@ -2027,7 +2027,7 @@ SplitDnsObj::SplitDnsObj(TokenList * tokens)
// fields are already defined!!
goto FORMAT_ERR;
}
- m_ele->def_domain = xstrdup(tok->value);
+ m_ele->def_domain = ats_strdup(tok->value);
} else if (strcmp(tok->name, "search_list") == 0) {
if ((m_ele->search_list != NULL) || (!tok->value)) {
// fields are already defined!!
@@ -2067,16 +2067,16 @@ SplitDnsObj::formatEleToRule()
char *pd_name;
switch (m_ele->pd_type) {
case TS_PD_DOMAIN:
- pd_name = xstrdup("dest_domain");
+ pd_name = ats_strdup("dest_domain");
break;
case TS_PD_HOST:
- pd_name = xstrdup("dest_host");
+ pd_name = ats_strdup("dest_host");
break;
case TS_PD_URL_REGEX:
- pd_name = xstrdup("url_regex");
+ pd_name = ats_strdup("url_regex");
break;
default:
- pd_name = xstrdup(""); // lv: just to make this junk workable
+ pd_name = ats_strdup(""); // lv: just to make this junk workable
// Handled here:
// TS_PD_IP, TS_PD_UNDEFINED
break;
@@ -2145,7 +2145,7 @@ SplitDnsObj::formatEleToRule()
ats_free(pd_name);
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool SplitDnsObj::isValid()
@@ -2219,7 +2219,7 @@ StorageObj::StorageObj(TokenList * tokens)
if (!tok->name) {
goto FORMAT_ERR; // no pathname specified
} else {
- m_ele->pathname = xstrdup(tok->name);
+ m_ele->pathname = ats_strdup(tok->name);
}
// check if size is specified
@@ -2255,7 +2255,7 @@ StorageObj::formatEleToRule()
snprintf(buf, sizeof(buf), "%s %d", m_ele->pathname, m_ele->size);
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool StorageObj::isValid()
@@ -2310,7 +2310,7 @@ UpdateObj::UpdateObj(TokenList * tokens)
if (strcmp(token->name, "") == 0) {
goto FORMAT_ERR;
}
- m_ele->url = xstrdup(token->name);
+ m_ele->url = ats_strdup(token->name);
// Request_headers
token = tokens->next(token);
@@ -2370,7 +2370,7 @@ UpdateObj::formatEleToRule()
m_ele->url, m_ele->offset_hour, m_ele->interval, m_ele->recursion_depth);
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool UpdateObj::isValid()
@@ -2459,7 +2459,7 @@ VirtIpAddrObj::VirtIpAddrObj(TokenList * tokens)
if (tok->value != NULL) {
goto FORMAT_ERR;
}
- m_ele->intr = xstrdup(tok->name);
+ m_ele->intr = ats_strdup(tok->name);
// Subinterface
tok = tokens->next(tok);
@@ -2496,7 +2496,7 @@ VirtIpAddrObj::formatEleToRule()
snprintf(buf, sizeof(buf), "%s %s %d", ip_str, m_ele->intr, m_ele->sub_intr);
ats_free(ip_str);
- return xstrdup(buf);
+ return ats_strdup(buf);
}
bool VirtIpAddrObj::isValid()
View
2  mgmt/api/CfgContextManager.cc
@@ -107,7 +107,7 @@ CfgContextCommit(CfgContext * ctx, LLQ * errRules)
rule = ele->formatEleToRule(); // use polymorphism
if (!rule) {
err = TS_ERR_INVALID_CONFIG_RULE;
- rule = xstrdup(FORMAT_TO_RULE_ERROR);
+ rule = ats_strdup(FORMAT_TO_RULE_ERROR);
if (errRules) {
iPtr = (int *)ats_malloc(sizeof(int));
*iPtr = index;
View
196 mgmt/api/CfgContextUtils.cc
@@ -83,8 +83,8 @@ string_to_ip_addr_ele(const char *str)
ele->type = TS_IP_RANGE;
const_ip_a = range_tokens[0];
const_ip_b = range_tokens[1];
- ip_a = xstrdup(const_ip_a);
- ip_b = xstrdup(const_ip_b);
+ ip_a = ats_strdup(const_ip_a);
+ ip_b = ats_strdup(const_ip_b);
// determine if ip's are cidr type; only test if ip_a is cidr, assume both are same
cidr_tokens.Initialize(ip_a, COPY_TOKS);
@@ -154,7 +154,7 @@ ip_addr_ele_to_string(TSIpAddrEle * ele)
}
ats_free(ip_a_str);
- str = xstrdup(buf);
+ str = ats_strdup(buf);
return str;
} else if (ele->type == TS_IP_RANGE) { // RANGE TYPE
@@ -173,7 +173,7 @@ ip_addr_ele_to_string(TSIpAddrEle * ele)
}
ats_free(ip_a_str);
ats_free(ip_b_str);
- str = xstrdup(buf);
+ str = ats_strdup(buf);
return str;
}
@@ -201,7 +201,7 @@ ip_addr_to_string(TSIpAddr ip)
if (!ccu_checkIpAddr(ip)) {
return NULL;
}
- return xstrdup((char *) ip);
+ return ats_strdup((char *) ip);
}
/* ----------------------------------------------------------------------------
@@ -218,7 +218,7 @@ string_to_ip_addr(const char *str)
return TS_INVALID_IP_ADDR;
char *copy;
- copy = xstrdup(str);
+ copy = ats_strdup(str);
return (TSIpAddr) copy;
}
@@ -262,7 +262,7 @@ ip_addr_list_to_string(IpAddrList * list, const char *delimiter)
enqueue((LLQ *) list, ip_ele); // return ip to list
}
- new_str = xstrdup(buf);
+ new_str = ats_strdup(buf);
return new_str;
}
@@ -356,7 +356,7 @@ port_list_to_string(PortList * ports, const char *delimiter)
enqueue((LLQ *) ports, port_ele); // return TSPortEle to list
}
- str = xstrdup(buf);
+ str = ats_strdup(buf);
return str;
Lerror:
@@ -425,7 +425,7 @@ port_ele_to_string(TSPortEle * ele)
snprintf(buf, sizeof(buf), "%d%c%d", ele->port_a, RANGE_DELIMITER, ele->port_b);
}
- str = xstrdup(buf);
+ str = ats_strdup(buf);
return str;
}
@@ -510,7 +510,7 @@ string_list_to_string(TSStringList str_list, const char *delimiter)
enqueue((LLQ *) str_list, str_ele);
}
- list_str = xstrdup(buf);
+ list_str = ats_strdup(buf);
return list_str;
}
@@ -533,7 +533,7 @@ string_to_string_list(const char *str, const char *delimiter)
TSStringList str_list = TSStringListCreate();
for (int i = 0; i < tokens.getNumber(); i++) {
- TSStringListEnqueue(str_list, xstrdup(tokens[i]));
+ TSStringListEnqueue(str_list, ats_strdup(tokens[i]));
}
return str_list;
@@ -575,7 +575,7 @@ int_list_to_string(TSIntList list, const char *delimiter)
}
enqueue((LLQ *) list, elem);
}
- return xstrdup(buf);
+ return ats_strdup(buf);
}
/* ---------------------------------------------------------------
@@ -701,7 +701,7 @@ domain_list_to_string(TSDomainList list, const char *delimiter)
enqueue((LLQ *) list, domain);
}
- list_str = xstrdup(buf);
+ list_str = ats_strdup(buf);
return list_str;
}
@@ -730,7 +730,7 @@ domain_to_string(TSDomain * domain)
return NULL; // invalid TSDomain
}
- dom_str = xstrdup(buf);
+ dom_str = ats_strdup(buf);
return dom_str;
}
@@ -761,7 +761,7 @@ string_to_domain(const char *str)
token = ink_strtok_r(buf, ":", &token_pos);
remain = token_pos;
if (token)
- dom->domain_val = xstrdup(token);
+ dom->domain_val = ats_strdup(token);
else
goto Lerror;
@@ -960,7 +960,7 @@ pdest_sspec_to_string(TSPrimeDestT pd, char *pd_val, TSSspec * sspec)
}
} while (0);
- str = xstrdup(buf);
+ str = ats_strdup(buf);
return str;
}
@@ -1003,7 +1003,7 @@ string_to_pdss_format(const char *str, TSPdSsFormat * pdss)
// pd_value
if (!tokens[2])
goto Lerror;
- pdss->pd_val = xstrdup(tokens[2]);
+ pdss->pd_val = ats_strdup(tokens[2]);
// check secondary specifiers; exists only if not empty string
// time
@@ -1013,15 +1013,15 @@ string_to_pdss_format(const char *str, TSPdSsFormat * pdss)
}
// src_ip
if (strlen(tokens[4]) > 0) {
- pdss->sec_spec.src_ip = xstrdup(tokens[4]);
+ pdss->sec_spec.src_ip = ats_strdup(tokens[4]);
}
// prefix
if (strlen(tokens[5]) > 0) {
- pdss->sec_spec.prefix = xstrdup(tokens[5]);
+ pdss->sec_spec.prefix = ats_strdup(tokens[5]);
}
// suffix
if (strlen(tokens[6]) > 0) {
- pdss->sec_spec.suffix = xstrdup(tokens[6]);
+ pdss->sec_spec.suffix = ats_strdup(tokens[6]);
}
// port
if (strlen(tokens[7]) > 0) { // no port
@@ -1069,7 +1069,7 @@ hms_time_to_string(TSHmsTime time)
(psize = snprintf(buf + buf_pos, sizeof(buf) - buf_pos, "%ds", time.s)) > 0)
buf_pos += psize;
- str = xstrdup(buf);
+ str = ats_strdup(buf);
return str;
}
@@ -1234,13 +1234,13 @@ header_type_to_string(TSHdrT hdr)
// header type
switch (hdr) {
case TS_HDR_DATE:
- return xstrdup("date");
+ return ats_strdup("date");
case TS_HDR_HOST:
- return xstrdup("host");
+ return ats_strdup("host");
case TS_HDR_COOKIE:
- return xstrdup("cookie");
+ return ats_strdup("cookie");
case TS_HDR_CLIENT_IP:
- return xstrdup("client_ip");
+ return ats_strdup("client_ip");
default:
break;
}
@@ -1270,9 +1270,9 @@ scheme_type_to_string(TSSchemeT scheme)
{
switch (scheme) {
case TS_SCHEME_HTTP:
- return xstrdup("http");
+ return ats_strdup("http");
case TS_SCHEME_HTTPS:
- return xstrdup("https");
+ return ats_strdup("https");
default:
break;
}
@@ -1308,15 +1308,15 @@ method_type_to_string(TSMethodT method)
{
switch (method) {
case TS_METHOD_GET:
- return xstrdup("get");
+ return ats_strdup("get");
case TS_METHOD_POST:
- return xstrdup("post");
+ return ats_strdup("post");
case TS_METHOD_PUT:
- return xstrdup("put");
+ return ats_strdup("put");
case TS_METHOD_TRACE:
- return xstrdup("trace");
+ return ats_strdup("trace");
case TS_METHOD_PUSH:
- return xstrdup("push");
+ return ats_strdup("push");
default:
break;
}
@@ -1333,9 +1333,9 @@ connect_type_to_string(TSConnectT conn)
{
switch (conn) {
case TS_CON_UDP:
- return xstrdup("udp");
+ return ats_strdup("udp");
case TS_CON_TCP:
- return xstrdup("tcp");
+ return ats_strdup("tcp");
default:
break;
}
@@ -1363,9 +1363,9 @@ multicast_type_to_string(TSMcTtlT mc)
{
switch (mc) {
case TS_MC_TTL_SINGLE_SUBNET:
- return xstrdup("single_subnet");
+ return ats_strdup("single_subnet");
case TS_MC_TTL_MULT_SUBNET:
- return xstrdup("multiple_subnet");
+ return ats_strdup("multiple_subnet");
default:
break;
}
@@ -1394,11 +1394,11 @@ round_robin_type_to_string(TSRrT rr)
{
switch (rr) {
case TS_RR_TRUE:
- return xstrdup("true");
+ return ats_strdup("true");
case TS_RR_FALSE:
- return xstrdup("false");
+ return ats_strdup("false");
case TS_RR_STRICT:
- return xstrdup("strict");
+ return ats_strdup("strict");
default:
break;
}
@@ -1416,50 +1416,50 @@ filename_to_string(TSFileNameT file)
{
switch (file) {
case TS_FNAME_CACHE_OBJ:
- return xstrdup("cache.config");
+ return ats_strdup("cache.config");
case TS_FNAME_CONGESTION:
- return xstrdup("congestion.config");
+ return ats_strdup("congestion.config");
case TS_FNAME_HOSTING:
- return xstrdup("hosting.config");
+ return ats_strdup("hosting.config");
case TS_FNAME_ICP_PEER:
- return xstrdup("icp.config");
+ return ats_strdup("icp.config");
case TS_FNAME_IP_ALLOW:
- return xstrdup("ip_allow.config");
+ return ats_strdup("ip_allow.config");
case TS_FNAME_LOGS_XML:
- return xstrdup("logs_xml.config");
+ return ats_strdup("logs_xml.config");
case TS_FNAME_PARENT_PROXY:
- return xstrdup("parent.config");
+ return ats_strdup("parent.config");
case TS_FNAME_VOLUME:
- return xstrdup("volume.config");
+ return ats_strdup("volume.config");
case TS_FNAME_PLUGIN:
- return xstrdup("plugin.config");
+ return ats_strdup("plugin.config");
case TS_FNAME_REMAP:
- return xstrdup("remap.config");
+ return ats_strdup("remap.config");
case TS_FNAME_SOCKS:
- return xstrdup("socks.config");
+ return ats_strdup("socks.config");
case TS_FNAME_SPLIT_DNS:
- return xstrdup("splitdns.config");
+ return ats_strdup("splitdns.config");
case TS_FNAME_STORAGE:
- return xstrdup("storage.config");
+ return ats_strdup("storage.config");
case TS_FNAME_UPDATE_URL:
- return xstrdup("update.config");
+ return ats_strdup("update.config");
case TS_FNAME_VADDRS:
- return xstrdup("vaddrs.config");
+ return ats_strdup("vaddrs.config");
default: /* no such config file */
@@ -1508,13 +1508,13 @@ admin_acc_type_to_string(TSAccessT access)
{
switch (access) {
case TS_ACCESS_NONE:
- return xstrdup("none");
+ return ats_strdup("none");
case TS_ACCESS_MONITOR:
- return xstrdup("monitor_only");
+ return ats_strdup("monitor_only");
case TS_ACCESS_MONITOR_VIEW:
- return xstrdup("monitor_config_view");
+ return ats_strdup("monitor_config_view");
case TS_ACCESS_MONITOR_CHANGE:
- return xstrdup("monitor_config_change");
+ return ats_strdup("monitor_config_change");
default:
break;
}
@@ -1563,7 +1563,7 @@ tokens_to_pdss_format(TokenList * tokens, Token * first_tok, TSPdSsFormat * pdss
} else {
return NULL; //INVALID primary destination specifier
}
- pdss->pd_val = xstrdup(first_tok->value);
+ pdss->pd_val = ats_strdup(first_tok->value);
// iterate through tokens checking for sec specifiers
@@ -1583,13 +1583,13 @@ tokens_to_pdss_format(TokenList * tokens, Token * first_tok, TSPdSsFormat * pdss
string_to_time_struct(tok->value, &(pdss->sec_spec));
goto next_token;
case 1: // src_ip
- pdss->sec_spec.src_ip = xstrdup(tok->value);
+ pdss->sec_spec.src_ip = ats_strdup(tok->value);
goto next_token;
case 2: // prefix
- pdss->sec_spec.prefix = xstrdup(tok->value);
+ pdss->sec_spec.prefix = ats_strdup(tok->value);
goto next_token;
case 3: // suffix
- pdss->sec_spec.suffix = xstrdup(tok->value);
+ pdss->sec_spec.suffix = ats_strdup(tok->value);
goto next_token;
case 4: // port
pdss->sec_spec.port = string_to_port_ele(tok->value);
@@ -2250,11 +2250,11 @@ copy_sspec(TSSspec * src, TSSspec * dst)
dst->time.hour_b = src->time.hour_b;
dst->time.min_b = src->time.min_b;
if (src->src_ip)
- dst->src_ip = xstrdup(src->src_ip);
+ dst->src_ip = ats_strdup(src->src_ip);
if (src->prefix)
- dst->prefix = xstrdup(src->prefix);
+ dst->prefix = ats_strdup(src->prefix);
if (src->suffix)
- dst->suffix = xstrdup(src->suffix);
+ dst->suffix = ats_strdup(src->suffix);
dst->port = copy_port_ele(src->port);
dst->method = src->method;
dst->scheme = src->scheme;
@@ -2269,7 +2269,7 @@ copy_pdss_format(TSPdSsFormat * src_pdss, TSPdSsFormat * dst_pdss)
dst_pdss->pd_type = src_pdss->pd_type;
if (src_pdss->pd_val)
- dst_pdss->pd_val = xstrdup(src_pdss->pd_val);
+ dst_pdss->pd_val = ats_strdup(src_pdss->pd_val);
copy_sspec(&(src_pdss->sec_spec), &(dst_pdss->sec_spec));
}
@@ -2296,11 +2296,11 @@ copy_ip_addr_ele(TSIpAddrEle * src_ele)
dst_ele = TSIpAddrEleCreate();
dst_ele->type = src_ele->type;
if (src_ele->ip_a)
- dst_ele->ip_a = xstrdup(src_ele->ip_a);
+ dst_ele->ip_a = ats_strdup(src_ele->ip_a);
dst_ele->cidr_a = src_ele->cidr_a;
dst_ele->port_a = src_ele->port_a;
if (src_ele->ip_b)
- dst_ele->ip_b = xstrdup(src_ele->ip_b);
+ dst_ele->ip_b = ats_strdup(src_ele->ip_b);
dst_ele->cidr_b = src_ele->cidr_b;
dst_ele->port_b = src_ele->port_b;
@@ -2332,7 +2332,7 @@ copy_domain(TSDomain * src_dom)
dst_dom = TSDomainCreate();
if (src_dom->domain_val)
- dst_dom->domain_val = xstrdup(src_dom->domain_val);
+ dst_dom->domain_val = ats_strdup(src_dom->domain_val);
dst_dom->port = src_dom->port;
return dst_dom;
@@ -2418,7 +2418,7 @@ copy_string_list(TSStringList list)
count = TSStringListLen(list);
for (i = 0; i < count; i++) {
ele = TSStringListDequeue(list);
- nele = xstrdup(ele);
+ nele = ats_strdup(ele);
TSStringListEnqueue(list, ele);
TSStringListEnqueue(nlist, nele);
}
@@ -2481,9 +2481,9 @@ copy_congestion_ele(TSCongestionEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
//copy_pdss_format(&(ele->congestion_info), &(nele->congestion_info));
nele->pd_type = ele->pd_type;
- nele->pd_val = xstrdup(ele->pd_val);
+ nele->pd_val = ats_strdup(ele->pd_val);
if (ele->prefix)
- nele->prefix = xstrdup(ele->prefix);
+ nele->prefix = ats_strdup(ele->prefix);
nele->port = ele->port;
nele->scheme = ele->scheme;
nele->max_connection_failures = ele->max_connection_failures;
@@ -2497,7 +2497,7 @@ copy_congestion_ele(TSCongestionEle * ele)
nele->dead_os_conn_retries = ele->dead_os_conn_retries;
nele->max_connection = ele->max_connection;
if (ele->error_page_uri)
- nele->error_page_uri = xstrdup(ele->error_page_uri);
+ nele->error_page_uri = ats_strdup(ele->error_page_uri);
return nele;
}
@@ -2517,7 +2517,7 @@ copy_hosting_ele(TSHostingEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
nele->pd_type = ele->pd_type;
if (ele->pd_val)
- nele->pd_val = xstrdup(ele->pd_val);
+ nele->pd_val = ats_strdup(ele->pd_val);
ele->volumes = copy_int_list(ele->volumes);
return nele;
@@ -2536,15 +2536,15 @@ copy_icp_ele(TSIcpEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
if (ele->peer_hostname)
- nele->peer_hostname = xstrdup(ele->peer_hostname);
+ nele->peer_hostname = ats_strdup(ele->peer_hostname);
if (ele->peer_host_ip_addr)
- nele->peer_host_ip_addr = xstrdup(ele->peer_host_ip_addr);
+ nele->peer_host_ip_addr = ats_strdup(ele->peer_host_ip_addr);
nele->peer_type = ele->peer_type;
nele->peer_proxy_port = ele->peer_proxy_port;
nele->peer_icp_port = ele->peer_icp_port;
nele->is_multicast = ele->is_multicast;
if (ele->mc_ip_addr)
- nele->mc_ip_addr = xstrdup(ele->mc_ip_addr);
+ nele->mc_ip_addr = ats_strdup(ele->mc_ip_addr);
nele->mc_ttl = ele->mc_ttl;
return nele;
@@ -2580,12 +2580,12 @@ copy_log_filter_ele(TSLogFilterEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
nele->action = ele->action;
if (ele->filter_name)
- ele->filter_name = xstrdup(nele->filter_name);
+ ele->filter_name = ats_strdup(nele->filter_name);
if (ele->log_field)
- nele->log_field = xstrdup(ele->log_field);
+ nele->log_field = ats_strdup(ele->log_field);
nele->compare_op = ele->compare_op;
if (ele->compare_str)
- nele->compare_str = xstrdup(ele->compare_str);
+ nele->compare_str = ats_strdup(ele->compare_str);
nele->compare_int = ele->compare_int;
return nele;
@@ -2604,9 +2604,9 @@ copy_log_format_ele(TSLogFormatEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
if (ele->name)
- nele->name = xstrdup(ele->name);
+ nele->name = ats_strdup(ele->name);
if (ele->format)
- nele->format = xstrdup(ele->format);
+ nele->format = ats_strdup(ele->format);
nele->aggregate_interval_secs = ele->aggregate_interval_secs;
return nele;
@@ -2625,9 +2625,9 @@ copy_log_object_ele(TSLogObjectEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
if (ele->format_name)
- nele->format_name = xstrdup(ele->format_name);
+ nele->format_name = ats_strdup(ele->format_name);
if (ele->file_name)
- nele->file_name = xstrdup(ele->file_name);
+ nele->file_name = ats_strdup(ele->file_name);
nele->log_mode = ele->log_mode;
nele->collation_hosts = copy_domain_list(ele->collation_hosts);
nele->filters = copy_string_list(ele->filters);
@@ -2690,7 +2690,7 @@ copy_plugin_ele(TSPluginEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
if (ele->name)
- nele->name = xstrdup(ele->name);
+ nele->name = ats_strdup(ele->name);
nele->args = copy_string_list(ele->args);
return nele;
@@ -2711,16 +2711,16 @@ copy_remap_ele(TSRemapEle * ele)
nele->map = ele->map;
nele->from_scheme = ele->from_scheme;
if (ele->from_host)
- nele->from_host = xstrdup(ele->from_host);
+ nele->from_host = ats_strdup(ele->from_host);
nele->from_port = ele->from_port;
if (ele->from_path_prefix)
- nele->from_path_prefix = xstrdup(ele->from_path_prefix);
+ nele->from_path_prefix = ats_strdup(ele->from_path_prefix);
nele->to_scheme = ele->to_scheme;
if (ele->to_host)
- nele->to_host = xstrdup(ele->to_host);
+ nele->to_host = ats_strdup(ele->to_host);
nele->to_port = ele->to_port;
if (ele->to_path_prefix)
- nele->to_path_prefix = xstrdup(ele->to_path_prefix);
+ nele->to_path_prefix = ats_strdup(ele->to_path_prefix);
return nele;
}
@@ -2742,9 +2742,9 @@ copy_socks_ele(TSSocksEle * ele)
nele->socks_servers = copy_domain_list(ele->socks_servers);
nele->rr = ele->rr;
if (ele->username)
- nele->username = xstrdup(ele->username);
+ nele->username = ats_strdup(ele->username);
if (ele->password)
- nele->password = xstrdup(ele->password);
+ nele->password = ats_strdup(ele->password);
return nele;
}
@@ -2763,10 +2763,10 @@ copy_split_dns_ele(TSSplitDnsEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
nele->pd_type = ele->pd_type;
if (ele->pd_val)
- nele->pd_val = xstrdup(ele->pd_val);
+ nele->pd_val = ats_strdup(ele->pd_val);
nele->dns_servers_addrs = copy_domain_list(ele->dns_servers_addrs);
if (ele->def_domain)
- nele->def_domain = xstrdup(ele->def_domain);
+ nele->def_domain = ats_strdup(ele->def_domain);
nele->search_list = copy_domain_list(ele->search_list);
return nele;
@@ -2785,7 +2785,7 @@ copy_storage_ele(TSStorageEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
if (ele->pathname)
- nele->pathname = xstrdup(ele->pathname);
+ nele->pathname = ats_strdup(ele->pathname);
nele->size = ele->size;
return nele;
@@ -2804,7 +2804,7 @@ copy_update_ele(TSUpdateEle * ele)
copy_cfg_ele(&(ele->cfg_ele), &(nele->cfg_ele));
if (ele->url)
- nele->url = xstrdup(ele->url);
+ nele->url = ats_strdup(ele->url);
nele->headers = copy_string_list(ele->headers);
nele->offset_hour = ele->offset_hour;
nele->interval = ele->interval;
@@ -2828,8 +2828,8 @@ copy_virt_ip_addr_ele(TSVirtIpAddrEle * ele)
// copy cfg ele
copy_cfg_ele(&(ele->cfg_ele), &(new_ele->cfg_ele));
- new_ele->ip_addr = xstrdup(ele->ip_addr);
- new_ele->intr = xstrdup(ele->intr);
+ new_ele->ip_addr = ats_strdup(ele->ip_addr);
+ new_ele->intr = ats_strdup(ele->intr);
new_ele->sub_intr = ele->sub_intr;
return new_ele;
@@ -2858,7 +2858,7 @@ comment_ele_create(char *comment)
ele->cfg_ele.type = TS_TYPE_COMMENT;
ele->cfg_ele.error = TS_ERR_OKAY;
if (comment)
- ele->comment = xstrdup(comment);
+ ele->comment = ats_strdup(comment);
else // comment is NULL
ele->comment = NULL;
View
12 mgmt/api/CoreAPI.cc
@@ -207,7 +207,7 @@ ProxyStateSet(TSProxyStateT state, TSCacheClearT clear)
if (strlen(tsArgs) > 0) { /* Passed command line args for proxy */
ats_free(lmgmt->proxy_options);
- lmgmt->proxy_options = xstrdup(tsArgs);
+ lmgmt->proxy_options = ats_strdup(tsArgs);
mgmt_log("[ProxyStateSet] Traffic Server Args: '%s'\n", lmgmt->proxy_options);
}
@@ -313,7 +313,7 @@ MgmtRecordGet(const char *rec_name, TSRecordEle * rec_ele)
Debug("RecOp", "[MgmtRecordGet] Start\n");
// initialize the record name
- rec_ele->rec_name = xstrdup(rec_name);
+ rec_ele->rec_name = ats_strdup(rec_name);
memset(rec_val, 0, MAX_BUF_SIZE);
// get variable type; returns INVALID if invalid rec_name
@@ -352,9 +352,9 @@ MgmtRecordGet(const char *rec_name, TSRecordEle * rec_ele)
if (rec_val[0] != '\0') { // non-NULL string value
// allocate memory & duplicate string value
- str_val = xstrdup(rec_val);
+ str_val = ats_strdup(rec_val);
} else {
- str_val = xstrdup("NULL");
+ str_val = ats_strdup("NULL");
}
rec_ele->rec_type = TS_REC_STRING;
@@ -566,7 +566,7 @@ ReadFile(TSFileNameT file, char **text, int *size, int *version)
old_file_lines = old_file_content->bufPtr();
old_file_len = strlen(old_file_lines);
- *text = xstrdup(old_file_lines); //make copy before deleting textBuffer
+ *text = ats_strdup(old_file_lines); //make copy before deleting textBuffer
*size = old_file_len;
delete old_file_content; // delete textBuffer
@@ -879,7 +879,7 @@ SnapshotGetMlt(LLQ * snapshots)
for (int i = 0; i < num_snaps; i++) {
snap_name = (char *) (snap_list[i]);
if (snap_name)
- enqueue(snapshots, xstrdup(snap_name));
+ enqueue(snapshots, ats_strdup(snap_name));
}
return TS_ERR_OKAY;
View
2  mgmt/api/CoreAPIShared.cc
@@ -513,5 +513,5 @@ get_event_name(int id)
return NULL;
}
- return xstrdup(name);
+ return ats_strdup(name);
}
View
6 mgmt/api/EventControlMain.cc
@@ -210,11 +210,11 @@ apiEventCallback(alarm_t newAlarm, char *ip, char *desc)
newEvent = TSEventCreate();
newEvent->id = newAlarm;
newEvent->name = get_event_name(newEvent->id);
- //newEvent->ip = xstrdup(ip);
+ //newEvent->ip = ats_strdup(ip);
if (desc)
- newEvent->description = xstrdup(desc);
+ newEvent->description = ats_strdup(desc);
else
- newEvent->description = xstrdup("None");
+ newEvent->description = ats_strdup("None");
//add it to the mgmt_events list
ink_mutex_acquire(&mgmt_events_lock);
View
22 mgmt/api/GenericParser.cc
@@ -45,7 +45,7 @@ void
Token::setName(const char *str)
{
name = (char *) strtrim(str);
- //name = xstrdup(str_copy); DOESN't WORK
+ //name = ats_strdup(str_copy); DOESN't WORK
}
//
@@ -56,8 +56,8 @@ void
Token::setValue(const char *str)
{
char *str_copy = (char *) strtrim(str);
- // Can't use xstrdup after strtrim?
- // value = xstrdup(str);
+ // Can't use ats_strdup after strtrim?
+ // value = ats_strdup(str);
ink_assert(value == NULL);
if (str_copy) {
size_t len = strlen(str_copy);
@@ -147,21 +147,21 @@ void
Rule::setRuleStr(const char *str)
{
ink_assert(m_comment == NULL);
- m_ruleStr = xstrdup(str);
+ m_ruleStr = ats_strdup(str);
}
void
Rule::setComment(const char *str)
{
ink_assert(m_comment == NULL);
- m_comment = xstrdup(str);
+ m_comment = ats_strdup(str);
}
void
Rule::setErrorHint(const char *str)
{
ink_assert(m_errorHint == NULL);
- m_errorHint = xstrdup(str);
+ m_errorHint = ats_strdup(str);
}
Rule::~Rule()
@@ -335,7 +335,7 @@ Rule::cacheParse(char *rule, unsigned short minNumToken, unsigned short maxNumTo
for TSqa09488 */
const char *secondEqual = strstr(strstr(tokenStr, "="), "=");
secondEqual++;
- subtoken = xstrdup(secondEqual);
+ subtoken = ats_strdup(secondEqual);
}
insideQuote = inQuote(subtoken);
@@ -644,7 +644,7 @@ Rule::socksParse(char *rule)
for TSqa09488 */
const char *secondEqual = strstr(strstr(tokenStr, "="), "=");
secondEqual++;
- subtoken = xstrdup(secondEqual);
+ subtoken = ats_strdup(secondEqual);
}
insideQuote = inQuote(subtoken);
@@ -924,7 +924,7 @@ RuleList::Print()
void
RuleList::parse(char *fileBuf, const char *filename)
{
- m_filename = xstrdup(filename);
+ m_filename = ats_strdup(filename);
if (strstr(filename, "cache.config")) {
m_filetype = TS_FNAME_CACHE_OBJ; /* cache.config */
@@ -1050,7 +1050,7 @@ strtrim(char *str) {
const char *
strtrim(const char *str_in, char chr)
{
- char *str = xstrdup(str_in);
+ char *str = ats_strdup(str_in);
char *str_ptr = str; // so we can free str later if it changes
while (*str == chr) {
@@ -1060,7 +1060,7 @@ strtrim(const char *str_in, char chr)
str[strlen(str) - 1] = '\0';
}
- char *newStr = xstrdup(str);
+ char *newStr = ats_strdup(str);
ats_free(str_ptr);
return newStr;
}
View
34 mgmt/api/INKMgmtAPI.cc
@@ -64,7 +64,7 @@ _TSrealloc(void *ptr, unsigned int size, const char *path)
char *
_TSstrdup(const char *str, int length, const char *path)
{
- return xstrndup(str, length);
+ return ats_strndup(str, length);
}
void
@@ -941,7 +941,7 @@ TSCongestionEleCreate()
ele->dead_os_conn_timeout = 15;
ele->dead_os_conn_retries = 1;
ele->max_connection = -1;
- ele->error_page_uri = xstrdup("congestion#retryAfter");
+ ele->error_page_uri = ats_strdup("congestion#retryAfter");
return ele;
}
@@ -1899,7 +1899,7 @@ TSGetErrorMessage(TSError err_id)
break;
}
- err_msg = xstrdup(msg);
+ err_msg = ats_strdup(msg);
return err_msg;
}
@@ -2006,24 +2006,24 @@ TSReadFromUrlEx(const char *url, char **header, int *headerSize, char **body, in
const char *tempPath = strstr(url, "/");
char *host_and_port;
if (tempPath) {
- host_and_port = xstrndup(url, strlen(url) - strlen(tempPath));
+ host_and_port = ats_strndup(url, strlen(url) - strlen(tempPath));
tempPath += 1; // advance one position to get rid of leading '/'
- httpPath = xstrdup(tempPath);
+ httpPath = ats_strdup(tempPath);
} else {
- host_and_port = xstrdup(url);
- httpPath = xstrdup("");
+ host_and_port = ats_strdup(url);
+ httpPath = ats_strdup("");
}
// the port proceed by a ":", if it exists
char *colon = strstr(host_and_port, ":");
if (colon) {
- httpHost = xstrndup(host_and_port, strlen(host_and_port) - strlen(colon));
+ httpHost = ats_strndup(host_and_port, strlen(host_and_port) - strlen(colon));
colon += 1; // advance one position to get rid of leading ':'
httpPort = ink_atoi(colon);
if (httpPort <= 0)
httpPort = HTTP_PORT;
} else {
- httpHost = xstrdup(host_and_port);
+ httpHost = ats_strdup(host_and_port);
}
ats_free(host_and_port);
@@ -2047,8 +2047,8 @@ TSReadFromUrlEx(const char *url, char **header, int *headerSize, char **body, in
goto END;
if (header && headerSize)
- *header = xstrndup(hdr_temp, *headerSize);
- *body = xstrndup(bdy_temp, *bodySize);
+ *header = ats_strndup(hdr_temp, *headerSize);
+ *body = ats_strndup(bdy_temp, *bodySize);
END:
ats_free(httpHost);
@@ -2091,7 +2091,7 @@ TSLookupFromCacheUrl(TSString url, TSString * info)
if ((err = parseHTTPResponse(response, &header, &hdr_size, &body, &bdy_size)) != TS_ERR_OKAY)
goto END;
- *info = xstrndup(body, bdy_size);
+ *info = ats_strndup(body, bdy_size);
END:
return err;
@@ -2129,7 +2129,7 @@ TSLookupFromCacheUrlRegex(TSString url_regex, TSString * list)
if ((err = parseHTTPResponse(response, &header, &hdr_size, &body, &bdy_size)) != TS_ERR_OKAY)
goto END;
- *list = xstrndup(body, bdy_size);
+ *list = ats_strndup(body, bdy_size);
END:
return err;
}
@@ -2166,7 +2166,7 @@ TSDeleteFromCacheUrl(TSString url, TSString * info)
if ((err = parseHTTPResponse(response, &header, &hdr_size, &body, &bdy_size)) != TS_ERR_OKAY)
goto END;
- *info = xstrndup(body, bdy_size);
+ *info = ats_strndup(body, bdy_size);
END:
return err;
@@ -2204,7 +2204,7 @@ TSDeleteFromCacheUrlRegex(TSString url_regex, TSString * list)
if ((err = parseHTTPResponse(response, &header, &hdr_size, &body, &bdy_size)) != TS_ERR_OKAY)
goto END;
- *list = xstrndup(body, bdy_size);
+ *list = ats_strndup(body, bdy_size);
END:
return err;
}