Permalink
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...
1 parent f2088d3 commit 51a214fa271d48b4adf8f49584676b8473b31b0f @zwoop zwoop committed Sep 7, 2011
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
@@ -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
@@ -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);
@@ -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;
@@ -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
@@ -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;
@@ -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;
@@ -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
@@ -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) {
@@ -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
@@ -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
@@ -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) {
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
Oops, something went wrong.

0 comments on commit 51a214f

Please sign in to comment.