Repository: trafficserver Updated Branches: refs/heads/master 3d1017fe1 -> 7bb4e9bf2
TS-2952: Remove xptr. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7bb4e9bf Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7bb4e9bf Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7bb4e9bf Branch: refs/heads/master Commit: 7bb4e9bf2322856f02f4dd47e379de76e6a1805c Parents: 3d1017f Author: Alan M. Carroll <[email protected]> Authored: Tue Jul 22 16:18:08 2014 -0500 Committer: Alan M. Carroll <[email protected]> Committed: Tue Jul 22 16:18:08 2014 -0500 ---------------------------------------------------------------------- iocore/cache/Cache.cc | 2 +- iocore/cache/CacheHosting.cc | 4 +- iocore/cache/Store.cc | 2 +- iocore/cluster/ClusterMachine.cc | 2 +- iocore/hostdb/HostDB.cc | 6 +- iocore/hostdb/MultiCache.cc | 4 +- iocore/net/SSLCertLookup.cc | 2 +- iocore/net/SSLUtils.cc | 38 ++++++------ lib/records/P_RecCore.cc | 4 +- lib/records/RecConfigParse.cc | 2 +- lib/records/RecCore.cc | 2 +- lib/ts/ink_memory.h | 112 ---------------------------------- mgmt/Alarms.cc | 10 +-- mgmt/FileManager.cc | 2 +- mgmt/LocalManager.cc | 16 ++--- mgmt/Main.cc | 4 +- mgmt/ProcessManager.cc | 2 +- mgmt/cluster/VMap.cc | 2 +- mgmt/web2/WebIntrMain.cc | 2 +- proxy/ControlMatcher.cc | 2 +- proxy/ICPConfig.cc | 2 +- proxy/IPAllow.cc | 2 +- proxy/InkAPITest.cc | 2 +- proxy/Main.cc | 12 ++-- proxy/Prefetch.cc | 2 +- proxy/StatSystem.cc | 2 +- proxy/Update.cc | 2 +- proxy/http/HttpBodyFactory.cc | 2 +- proxy/http/remap/RemapConfig.cc | 4 +- proxy/logging/LogConfig.cc | 4 +- proxy/shared/DiagsConfig.cc | 2 +- 31 files changed, 72 insertions(+), 184 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/cache/Cache.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 55fb82f..64a0d7a 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -3428,7 +3428,7 @@ ink_cache_init(ModuleVersion v) } if (theCacheStore.n_disks == 0) { - xptr<char> path(RecConfigReadConfigPath("proxy.config.cache.storage_filename", "storage.config")); + ats_scoped_str path(RecConfigReadConfigPath("proxy.config.cache.storage_filename", "storage.config")); Warning("no cache disks specified in %s: cache disabled\n", (const char *)path); //exit(1); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/cache/CacheHosting.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc index dabbef6..66f3b0d 100644 --- a/iocore/cache/CacheHosting.cc +++ b/iocore/cache/CacheHosting.cc @@ -192,7 +192,7 @@ CacheHostMatcher::NewEntry(matcher_line * line_info) CacheHostTable::CacheHostTable(Cache * c, CacheType typ) { - xptr<char> config_path; + ats_scoped_str config_path; config_tags = &CacheHosting_tags; ink_assert(config_tags != NULL); @@ -625,7 +625,7 @@ CacheHostRecord::Print() void ConfigVolumes::read_config_file() { - xptr<char> config_path; + ats_scoped_str config_path; char *file_buf; config_path = RecConfigReadConfigPath("proxy.config.cache.volume_filename"); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/cache/Store.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc index 70acf48..3f41808 100644 --- a/iocore/cache/Store.cc +++ b/iocore/cache/Store.cc @@ -309,7 +309,7 @@ Store::read_config(int fd) // Get pathname if not checking file if (fd < 0) { - xptr<char> storage_path(RecConfigReadConfigPath("proxy.config.cache.storage_filename", "storage.config")); + ats_scoped_str storage_path(RecConfigReadConfigPath("proxy.config.cache.storage_filename", "storage.config")); Debug("cache_init", "Store::read_config, fd = -1, \"%s\"", (const char *)storage_path); fd = ::open(storage_path, O_RDONLY); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/cluster/ClusterMachine.cc ---------------------------------------------------------------------- diff --git a/iocore/cluster/ClusterMachine.cc b/iocore/cluster/ClusterMachine.cc index 244d8d6..7889c41 100644 --- a/iocore/cluster/ClusterMachine.cc +++ b/iocore/cluster/ClusterMachine.cc @@ -214,7 +214,7 @@ read_MachineList(char *filename, int afd) int n = -1, i = 0, ln = 0; MachineList *l = NULL; ink_assert(filename || (afd != -1)); - xptr<char> path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename)); + ats_scoped_str path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename)); int fd = ((afd != -1) ? afd : open(path, O_RDONLY)); if (fd >= 0) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/hostdb/HostDB.cc ---------------------------------------------------------------------- diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index 5d239ee..1b082ee 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -386,7 +386,7 @@ HostDBCache::start(int flags) // If proxy.config.hostdb.storage_path is not set, use the local state dir. If it is set to // a relative path, make it relative to the prefix. if (storage_path[0] == '\0') { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); ink_strlcpy(storage_path, rundir, sizeof(storage_path)); } else if (storage_path[0] != '/') { Layout::relative_to(storage_path, sizeof(storage_path), Layout::get()->prefix, storage_path); @@ -406,8 +406,8 @@ HostDBCache::start(int flags) Debug("hostdb", "Opening %s, size=%d", hostdb_filename, hostdb_size); if (open(hostDBStore, "hostdb.config", hostdb_filename, hostdb_size, reconfigure, fix, false /* slient */ ) < 0) { - xptr<char> rundir(RecConfigReadRuntimeDir()); - xptr<char> config(Layout::relative_to(rundir, "hostdb.config")); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); + ats_scoped_str config(Layout::relative_to(rundir, "hostdb.config")); Note("reconfiguring host database"); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/hostdb/MultiCache.cc ---------------------------------------------------------------------- diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc index f54fc20..cafa05c 100644 --- a/iocore/hostdb/MultiCache.cc +++ b/iocore/hostdb/MultiCache.cc @@ -502,7 +502,7 @@ int MultiCacheBase::read_config(const char *config_filename, Store & s, char *fn, int *pi, int *pbuck) { int scratch; - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); char p[PATH_NAME_MAX + 1], buf[256]; Layout::relative_to(p, sizeof(p), rundir, config_filename); @@ -538,7 +538,7 @@ MultiCacheBase::read_config(const char *config_filename, Store & s, char *fn, in int MultiCacheBase::write_config(const char *config_filename, int nominal_size, int abuckets) { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); char p[PATH_NAME_MAX + 1], buf[256]; int fd, retcode = -1; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/net/SSLCertLookup.cc ---------------------------------------------------------------------- diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc index bde0862..253f9a2 100644 --- a/iocore/net/SSLCertLookup.cc +++ b/iocore/net/SSLCertLookup.cc @@ -230,7 +230,7 @@ SSLContextStorage::insert(SSL_CTX * ctx, const char * name) // so that we can do a longest match lookup. char namebuf[TS_MAX_HOST_NAME_LEN + 1]; char * reversed; - xptr<SSLEntry> entry; + ats_scoped_obj<SSLEntry> entry; reversed = reverse_dns_name(name + 1, namebuf); if (!reversed) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/iocore/net/SSLUtils.cc ---------------------------------------------------------------------- diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc index a745124..1970036 100644 --- a/iocore/net/SSLUtils.cc +++ b/iocore/net/SSLUtils.cc @@ -87,13 +87,13 @@ struct ssl_user_config } int session_ticket_enabled; // ssl_ticket_enabled - session ticket enabled - xptr<char> addr; // dest_ip - IPv[64] address to match - xptr<char> cert; // ssl_cert_name - certificate - xptr<char> first_cert; // the first certificate name when multiple cert files are in 'ssl_cert_name' - xptr<char> ca; // ssl_ca_name - CA public certificate - xptr<char> key; // ssl_key_name - Private key - xptr<char> ticket_key_filename; // ticket_key_name - session key file. [key_name (16Byte) + HMAC_secret (16Byte) + AES_key (16Byte)] - xptr<char> dialog; // ssl_key_dialog - Private key dialog + ats_scoped_str addr; // dest_ip - IPv[64] address to match + ats_scoped_str cert; // ssl_cert_name - certificate + ats_scoped_str first_cert; // the first certificate name when multiple cert files are in 'ssl_cert_name' + ats_scoped_str ca; // ssl_ca_name - CA public certificate + ats_scoped_str key; // ssl_key_name - Private key + ats_scoped_str ticket_key_filename; // ticket_key_name - session key file. [key_name (16Byte) + HMAC_secret (16Byte) + AES_key (16Byte)] + ats_scoped_str dialog; // ssl_key_dialog - Private key dialog }; // Check if the ticket_key callback #define is available, and if so, enable session tickets. @@ -286,7 +286,7 @@ static SSL_CTX * ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path) { #if HAVE_OPENSSL_SESSION_TICKETS - xptr<char> ticket_key_data; + ats_scoped_str ticket_key_data; int ticket_key_len; ssl_ticket_key_t * ticket_key = NULL; @@ -897,7 +897,7 @@ static bool SSLPrivateKeyHandler( SSL_CTX * ctx, const SSLConfigParams * params, - const xptr<char>& completeServerCertPath, + const ats_scoped_str& completeServerCertPath, const char * keyPath) { if (!keyPath) { @@ -907,7 +907,7 @@ SSLPrivateKeyHandler( return false; } } else if (params->serverKeyPathOnly != NULL) { - xptr<char> completeServerKeyPath(Layout::get()->relative_to(params->serverKeyPathOnly, keyPath)); + ats_scoped_str completeServerKeyPath(Layout::get()->relative_to(params->serverKeyPathOnly, keyPath)); if (!SSL_CTX_use_PrivateKey_file(ctx, completeServerKeyPath, SSL_FILETYPE_PEM)) { SSLError("failed to load server private key from %s", (const char *) completeServerKeyPath); return false; @@ -931,7 +931,7 @@ SSLInitServerContext( { int session_id_context; int server_verify_client; - xptr<char> completeServerCertPath; + ats_scoped_str completeServerCertPath; SSL_CTX * ctx = SSLDefaultServerContext(); // disable selected protocols @@ -1016,7 +1016,7 @@ SSLInitServerContext( // First, load any CA chains from the global chain file. if (params->serverCertChainFilename) { - xptr<char> completeServerCertChainPath(Layout::relative_to(params->serverCertPathOnly, params->serverCertChainFilename)); + ats_scoped_str completeServerCertChainPath(Layout::relative_to(params->serverCertPathOnly, params->serverCertChainFilename)); if (!SSL_CTX_add_extra_chain_cert_file(ctx, completeServerCertChainPath)) { SSLError("failed to load global certificate chain from %s", (const char *) completeServerCertChainPath); goto fail; @@ -1025,7 +1025,7 @@ SSLInitServerContext( // Now, load any additional certificate chains specified in this entry. if (sslMultCertSettings.ca) { - xptr<char> completeServerCertChainPath(Layout::relative_to(params->serverCertPathOnly, sslMultCertSettings.ca)); + ats_scoped_str completeServerCertChainPath(Layout::relative_to(params->serverCertPathOnly, sslMultCertSettings.ca)); if (!SSL_CTX_add_extra_chain_cert_file(ctx, completeServerCertChainPath)) { SSLError("failed to load certificate chain from %s", (const char *) completeServerCertChainPath); goto fail; @@ -1215,7 +1215,7 @@ ssl_index_certificate(SSLCertLookup * lookup, SSL_CTX * ctx, const char * certfi X509_NAME_ENTRY * e = X509_NAME_get_entry(subject, pos); ASN1_STRING * cn = X509_NAME_ENTRY_get_data(e); - xptr<char> name(asn1_strdup(cn)); + ats_scoped_str name(asn1_strdup(cn)); Debug("ssl", "mapping '%s' to certificate %s", (const char *) name, certfile); lookup->insert(ctx, name); @@ -1232,7 +1232,7 @@ ssl_index_certificate(SSLCertLookup * lookup, SSL_CTX * ctx, const char * certfi name = sk_GENERAL_NAME_value(names, i); if (name->type == GEN_DNS) { - xptr<char> dns(asn1_strdup(name->d.dNSName)); + ats_scoped_str dns(asn1_strdup(name->d.dNSName)); Debug("ssl", "mapping '%s' to certificate %s", (const char *) dns, certfile); lookup->insert(ctx, dns); } @@ -1283,8 +1283,8 @@ ssl_store_ssl_context( const ssl_user_config & sslMultCertSettings) { SSL_CTX * ctx; - xptr<char> certpath; - xptr<char> session_key_path; + ats_scoped_str certpath; + ats_scoped_str session_key_path; ctx = ssl_context_enable_sni(SSLInitServerContext(params, sslMultCertSettings), lookup); if (!ctx) { @@ -1330,7 +1330,7 @@ ssl_store_ssl_context( // Load the session ticket key if session tickets are not disabled and we have key name. if (sslMultCertSettings.session_ticket_enabled != 0 && sslMultCertSettings.ticket_key_filename) { - xptr<char> ticket_key_path(Layout::relative_to(params->serverCertPathOnly, sslMultCertSettings.ticket_key_filename)); + ats_scoped_str ticket_key_path(Layout::relative_to(params->serverCertPathOnly, sslMultCertSettings.ticket_key_filename)); ssl_context_enable_tickets(ctx, ticket_key_path); } @@ -1413,7 +1413,7 @@ SSLParseCertificateConfiguration( { char * tok_state = NULL; char * line = NULL; - xptr<char> file_buf; + ats_scoped_str file_buf; unsigned line_num = 0; matcher_line line_info; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/lib/records/P_RecCore.cc ---------------------------------------------------------------------- diff --git a/lib/records/P_RecCore.cc b/lib/records/P_RecCore.cc index 5f0a8b3..3afa600 100644 --- a/lib/records/P_RecCore.cc +++ b/lib/records/P_RecCore.cc @@ -534,7 +534,7 @@ RecReadStatsFile() RecMessage *m; RecMessageItr itr; RecPersistT persist_type = RECP_NULL; - xptr<char> snap_fpath(RecConfigReadPersistentStatsPath()); + ats_scoped_str snap_fpath(RecConfigReadPersistentStatsPath()); // lock our hash table ink_rwlock_wrlock(&g_records_rwlock); @@ -591,7 +591,7 @@ RecSyncStatsFile() RecMessage *m; int i, num_records; bool sync_to_disk; - xptr<char> snap_fpath(RecConfigReadPersistentStatsPath()); + ats_scoped_str snap_fpath(RecConfigReadPersistentStatsPath()); /* * g_mode_type should be initialized by http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/lib/records/RecConfigParse.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecConfigParse.cc b/lib/records/RecConfigParse.cc index 1ffb21b..d691ba5 100644 --- a/lib/records/RecConfigParse.cc +++ b/lib/records/RecConfigParse.cc @@ -85,7 +85,7 @@ RecFileImport_Xmalloc(const char *file, char **file_buf, int *file_size) const char * RecConfigOverrideFromEnvironment(const char * name, const char * value) { - xptr<char> envname(ats_strdup(name)); + ats_scoped_str envname(ats_strdup(name)); const char * envval = NULL; // Munge foo.bar.config into FOO_BAR_CONFIG. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/lib/records/RecCore.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc index 863f497..176f8b3 100644 --- a/lib/records/RecCore.cc +++ b/lib/records/RecCore.cc @@ -1179,7 +1179,7 @@ RecConfigReadConfigPath(const char * file_variable, const char * default_value) char * RecConfigReadPersistentStatsPath() { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); return Layout::relative_to(rundir, REC_RAW_STATS_FILE); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/lib/ts/ink_memory.h ---------------------------------------------------------------------- diff --git a/lib/ts/ink_memory.h b/lib/ts/ink_memory.h index c9ad09e..0b1ea5f 100644 --- a/lib/ts/ink_memory.h +++ b/lib/ts/ink_memory.h @@ -171,116 +171,6 @@ ink_zero(T& t) { memset(&t, 0, sizeof(t)); } -/** Locally scoped holder for a chunk of memory allocated via these functions. - If this pointer is assigned the current memory (if any) is freed. - The memory is also freed when the object is destructed. This makes - handling temporary memory in a function more robust. - - @DEPRECATED - - Use @c ats_scoped_str for @c xptr<char> - Use @c ats_scoped_mem<T> for @c xptr<T> (uses @c ats_malloc / @c ats_free ) - Use @c ats_scoped_obj<T> for pointers to other types using @c new and @c delete. - - @internal A poor substitute for a real shared pointer copy on write - class but one step at a time. It's better than doing this by - hand every time. -*/ -template <typename T> class xptr { - public: - typedef xptr self; - - xptr() - : m_ptr(0) - { } - - /// Construct from allocated memory. - /// @note @a ptr must refer to memory allocated @c ats_malloc. - explicit xptr(T* ptr) - : m_ptr(ptr) - { } - - /// Construct and initialized with memory for @a n instances of @a T. - explicit xptr(size_t n) - : m_ptr((T *)ats_malloc(sizeof(T) * n)) - { } - - /// Destructor - free memory held by this instance. - ~xptr() - { - ats_free(m_ptr); - } - - /// Assign memory. - /// @note @a ptr must be allocated via @c ats_malloc. - self& operator = (T* ptr) { - ats_free(m_ptr); - m_ptr = ptr; - return *this; - } - - /// Auto convert to a raw pointer. - operator T* () { return m_ptr; } - - /// Auto convert to raw pointer. - operator T const* () const { return m_ptr; } - - /// Boolean operator. Returns true if we are pointing to valid memory. - operator bool() const { return m_ptr != 0; } - - /** Release memory from control of this instance. - - @note Although direct assignment is forbidden due to the - non-obvious semantics, a pointer can be moved (@b not copied) from - one instance to another using this method. - @code - new_ptr = old_ptr.release(); - @endcode - This is by design so any such transfer is always explicit. - */ - T* release() { - T* zret = m_ptr; - m_ptr = 0; - return zret; - } - - private: - T* m_ptr; ///< Pointer to allocated memory. - - /// Copy constructor - forbidden. - xptr(self const& that); - - /// Self assignment - forbidden. - self& operator = (self const& that); -}; - - -// Special operators for xptr<char> -/** Combine two strings as file paths. - Trailing and leading separators for @a lhs and @a rhs respectively - are handled to yield exactly one separator. - @return A newly @x ats_malloc string of the combined paths. -*/ -inline char* -path_join (xptr<char> const& lhs, xptr<char> const& rhs) -{ - size_t ln = strlen(lhs); - size_t rn = strlen(rhs); - char const* rptr = rhs; // May need to be modified. - - if (ln && lhs[ln-1] == '/') --ln; // drop trailing separator. - if (rn && *rptr == '/') --rn, ++rptr; // drop leading separator. - - char* x = static_cast<char*>(ats_malloc(ln + rn + 2)); - - memcpy(x, lhs, ln); - x[ln] = '/'; - memcpy(x + ln + 1, rptr, rn); - x[ln+rn+1] = 0; // terminate string. - - return x; -} - /** Scoped resources. An instance of this class is used to hold a contingent resource. When this object goes out of scope @@ -512,8 +402,6 @@ class ats_scoped_str : public ats_scoped_resource<detail::SCOPED_MALLOC_TRAITS<c }; /** Specialization of @c ats_scoped_resource for pointers allocated with @c ats_malloc. - - @note This is a drop in replacement for @c xptr<T>. */ template < typename T ///< Underlying (not pointer) type. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/mgmt/Alarms.cc ---------------------------------------------------------------------- diff --git a/mgmt/Alarms.cc b/mgmt/Alarms.cc index b972866..099adbf 100644 --- a/mgmt/Alarms.cc +++ b/mgmt/Alarms.cc @@ -493,13 +493,13 @@ Alarms::checkSystemNAlert() void Alarms::execAlarmBin(const char *desc) { - xptr<char> bindir(alarm_script_dir()); + ats_scoped_str bindir(alarm_script_dir()); char cmd_line[MAXPATHLEN]; - xptr<char> alarm_bin(REC_readString("proxy.config.alarm.bin", NULL)); - xptr<char> alarm_email_from_name; - xptr<char> alarm_email_from_addr; - xptr<char> alarm_email_to_addr; + ats_scoped_str alarm_bin(REC_readString("proxy.config.alarm.bin", NULL)); + ats_scoped_str alarm_email_from_name; + ats_scoped_str alarm_email_from_addr; + ats_scoped_str alarm_email_to_addr; pid_t pid; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/mgmt/FileManager.cc ---------------------------------------------------------------------- diff --git a/mgmt/FileManager.cc b/mgmt/FileManager.cc index 8480ede..fbdb688 100644 --- a/mgmt/FileManager.cc +++ b/mgmt/FileManager.cc @@ -58,7 +58,7 @@ FileManager::FileManager() ink_mutex_init(&accessLock, "File Manager Mutex"); ink_mutex_init(&cbListLock, "File Changed Callback Mutex"); - xptr<char> snapshotDir(RecConfigReadSnapshotDir()); + ats_scoped_str snapshotDir(RecConfigReadSnapshotDir()); // Check to see if the directory already exists, if not create it. if (access(snapshotDir, F_OK) == -1) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/mgmt/LocalManager.cc ---------------------------------------------------------------------- diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index 42ddd79..476ce82 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -144,7 +144,7 @@ LocalManager::clearStats(const char *name) // that operation works even when the proxy is off // if (this->proxy_running == 0) { - xptr<char> statsPath(RecConfigReadPersistentStatsPath()); + ats_scoped_str statsPath(RecConfigReadPersistentStatsPath()); if (unlink(statsPath) < 0) { if (errno != ENOENT) { mgmt_log(stderr, "[LocalManager::clearStats] Unlink of %s failed : %s\n", (const char *)statsPath, strerror(errno)); @@ -201,8 +201,8 @@ LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on) { bool found; - xptr<char> rundir(RecConfigReadRuntimeDir()); - xptr<char> bindir(RecConfigReadBinDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); + ats_scoped_str bindir(RecConfigReadBinDir()); #ifdef MGMT_USE_SYSLOG syslog_facility = 0; @@ -242,13 +242,13 @@ LocalManager::LocalManager(bool proxy_on) #if TS_HAS_WCCP // Bind the WCCP address if present. - xptr<char> wccp_addr_str(REC_readString("proxy.config.wccp.addr", &found)); + ats_scoped_str wccp_addr_str(REC_readString("proxy.config.wccp.addr", &found)); if (found && wccp_addr_str && *wccp_addr_str) { wccp_cache.setAddr(inet_addr(wccp_addr_str)); mgmt_log("[LocalManager::LocalManager] WCCP identifying address set to %s.\n", static_cast<char*>(wccp_addr_str)); } - xptr<char> wccp_config_str(REC_readString("proxy.config.wccp.services", &found)); + ats_scoped_str wccp_config_str(REC_readString("proxy.config.wccp.services", &found)); if (found && wccp_config_str && *wccp_config_str) { bool located = true; if (access(wccp_config_str, R_OK) == -1) { @@ -306,7 +306,7 @@ LocalManager::initAlarm() void LocalManager::initCCom(int mcport, char *addr, int rsport) { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); bool found; IpEndpoint cluster_ip; // ip addr of the cluster interface ip_text_buffer clusterAddrStr; // cluster ip addr as a String @@ -368,7 +368,7 @@ LocalManager::initCCom(int mcport, char *addr, int rsport) void LocalManager::initMgmtProcessServer() { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); char fpath[MAXPATHLEN]; int servlen, one = 1; struct sockaddr_un serv_addr; @@ -922,7 +922,7 @@ LocalManager::startProxy() int res; char env_prep_bin[MAXPATHLEN]; - xptr<char> bindir(RecConfigReadBinDir()); + ats_scoped_str bindir(RecConfigReadBinDir()); ink_filepath_make(env_prep_bin, sizeof(env_prep_bin), bindir, env_prep); res = execl(env_prep_bin, env_prep_bin, (char*)NULL); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/mgmt/Main.cc ---------------------------------------------------------------------- diff --git a/mgmt/Main.cc b/mgmt/Main.cc index b0c352f..2470be4 100644 --- a/mgmt/Main.cc +++ b/mgmt/Main.cc @@ -104,7 +104,7 @@ static void SigChldHandler(int sig); static void check_lockfile() { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); char lockfile[PATH_NAME_MAX]; int err; pid_t holding_pid; @@ -267,7 +267,7 @@ setup_coredump() static void init_dirs() { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); if (access(Layout::get()->sysconfdir, R_OK) == -1) { mgmt_elog(0, "unable to access() config dir '%s': %d, %s\n", Layout::get()->sysconfdir, errno, strerror(errno)); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/mgmt/ProcessManager.cc ---------------------------------------------------------------------- diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc index 0328893..1a9e292 100644 --- a/mgmt/ProcessManager.cc +++ b/mgmt/ProcessManager.cc @@ -69,7 +69,7 @@ startProcessManager(void *arg) ProcessManager::ProcessManager(bool rlm): BaseManager(), require_lm(rlm), mgmt_sync_key(0), local_manager_sockfd(0), cbtable(NULL) { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); ink_strlcpy(pserver_path, rundir, sizeof(pserver_path)); mgmt_signal_queue = create_queue(); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/mgmt/cluster/VMap.cc ---------------------------------------------------------------------- diff --git a/mgmt/cluster/VMap.cc b/mgmt/cluster/VMap.cc index ba2f32e..0a56286 100644 --- a/mgmt/cluster/VMap.cc +++ b/mgmt/cluster/VMap.cc @@ -310,7 +310,7 @@ VMap::lt_readAListFile(char * data) char tmp_addr[1024], tmp_interface[1024]; FILE *fin; char tmp_id[1024]; - xptr<char> vaddr_path(Layout::get()->relative_to(Layout::get()->sysconfdir, data)); + ats_scoped_str vaddr_path(Layout::get()->relative_to(Layout::get()->sysconfdir, data)); if (!(fin = fopen(vaddr_path, "r"))) { mgmt_log(stderr, "[VMap::lt_readAListFile] Unable to open file: %s, addr list unchanged\n", (const char *)vaddr_path); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/mgmt/web2/WebIntrMain.cc ---------------------------------------------------------------------- diff --git a/mgmt/web2/WebIntrMain.cc b/mgmt/web2/WebIntrMain.cc index 6f965c2..41d8e35 100644 --- a/mgmt/web2/WebIntrMain.cc +++ b/mgmt/web2/WebIntrMain.cc @@ -407,7 +407,7 @@ webIntr_main(void *) // set up socket paths; char api_sock_path[1024]; char event_sock_path[1024]; - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); bzero(api_sock_path, 1024); bzero(event_sock_path, 1024); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/ControlMatcher.cc ---------------------------------------------------------------------- diff --git a/proxy/ControlMatcher.cc b/proxy/ControlMatcher.cc index c7d8929..561bf6b 100644 --- a/proxy/ControlMatcher.cc +++ b/proxy/ControlMatcher.cc @@ -704,7 +704,7 @@ ControlMatcher<Data, Result>::ControlMatcher(const char *file_var, const char *n config_file_path[0] = '\0'; if (!(flags & DONT_BUILD_TABLE)) { - xptr<char> config_path(RecConfigReadConfigPath(file_var)); + ats_scoped_str config_path(RecConfigReadConfigPath(file_var)); ink_release_assert(config_path); ink_strlcpy(config_file_path, config_path, sizeof(config_file_path)); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/ICPConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc index b648585..5b957b1 100644 --- a/proxy/ICPConfig.cc +++ b/proxy/ICPConfig.cc @@ -545,7 +545,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu // ink_release_assert(filename != NULL); - xptr<char> config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename)); + ats_scoped_str config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename)); int fd = open(config_path, O_RDONLY); if (fd < 0) { Warning("read icp.config, open failed"); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/IPAllow.cc ---------------------------------------------------------------------- diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc index 25252e6..1b8687a 100644 --- a/proxy/IPAllow.cc +++ b/proxy/IPAllow.cc @@ -102,7 +102,7 @@ IpAllow::IpAllow( ) : module_name(name), action(action_val) { - xptr<char> config_path(RecConfigReadConfigPath(config_var)); + ats_scoped_str config_path(RecConfigReadConfigPath(config_var)); config_file_path[0] = '\0'; ink_release_assert(config_path); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/InkAPITest.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc index 73dd100..a784c1b 100644 --- a/proxy/InkAPITest.cc +++ b/proxy/InkAPITest.cc @@ -5338,7 +5338,7 @@ REGRESSION_TEST(SDK_API_TSTextLog) (RegressionTest * test, int /* atype ATS_UNUS /* Generate a random log file name, so if we run the test several times, we won't use the same log file name. */ - xptr<char> tmp(RecConfigReadLogDir()); + ats_scoped_str tmp(RecConfigReadLogDir()); snprintf(logname, sizeof(logname), "RegressionTestLog%d.log", (int) getpid()); snprintf(fullpath_logname, sizeof(fullpath_logname), "%s/%s", (const char *)tmp, logname); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/Main.cc ---------------------------------------------------------------------- diff --git a/proxy/Main.cc b/proxy/Main.cc index 8108be4..c1f97d7 100644 --- a/proxy/Main.cc +++ b/proxy/Main.cc @@ -248,8 +248,8 @@ init_system() static void check_lockfile() { - xptr<char> rundir(RecConfigReadRuntimeDir()); - xptr<char> lockfile; + ats_scoped_str rundir(RecConfigReadRuntimeDir()); + ats_scoped_str lockfile; pid_t holding_pid; int err; @@ -278,7 +278,7 @@ check_lockfile() static void check_config_directories(void) { - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); if (access(Layout::get()->sysconfdir, R_OK) == -1) { fprintf(stderr,"unable to access() config dir '%s': %d, %s\n", @@ -534,8 +534,8 @@ cmd_clear(char *cmd) bool c_cache = !strcmp(cmd, "clear_cache"); if (c_all || c_hdb) { - xptr<char> rundir(RecConfigReadRuntimeDir()); - xptr<char> config(Layout::relative_to(rundir, "hostdb.config")); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); + ats_scoped_str config(Layout::relative_to(rundir, "hostdb.config")); Note("Clearing HostDB Configuration"); if (unlink(config) < 0) @@ -1339,7 +1339,7 @@ main(int /* argc ATS_UNUSED */, char **argv) if (!num_task_threads) REC_ReadConfigInteger(num_task_threads, "proxy.config.task_threads"); - xptr<char> user(MAX_LOGIN + 1); + ats_scoped_str user(MAX_LOGIN + 1); *user = '\0'; admin_user_p = ((REC_ERR_OKAY == REC_ReadConfigString(user, "proxy.config.admin.user_id", MAX_LOGIN)) && http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/Prefetch.cc ---------------------------------------------------------------------- diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc index cadbdc2..9f49f19 100644 --- a/proxy/Prefetch.cc +++ b/proxy/Prefetch.cc @@ -1897,7 +1897,7 @@ config_read_proto(TSPrefetchBlastData &blast, const char *str) int PrefetchConfiguration::readConfiguration() { - xptr<char> conf_path; + ats_scoped_str conf_path; int fd = -1; local_http_server_port = stuffer_port = 0; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/StatSystem.cc ---------------------------------------------------------------------- diff --git a/proxy/StatSystem.cc b/proxy/StatSystem.cc index 755c1b5..3dd8a5e 100644 --- a/proxy/StatSystem.cc +++ b/proxy/StatSystem.cc @@ -472,7 +472,7 @@ initialize_all_global_stats() { int istat, i; char snap_file[PATH_NAME_MAX + 1]; - xptr<char> rundir(RecConfigReadRuntimeDir()); + ats_scoped_str rundir(RecConfigReadRuntimeDir()); if (access(rundir, R_OK | W_OK) == -1) { Warning("Unable to access() local state directory '%s': %d, %s", (const char *)rundir, errno, strerror(errno)); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/Update.cc ---------------------------------------------------------------------- diff --git a/proxy/Update.cc b/proxy/Update.cc index d4567ce..6481a49 100644 --- a/proxy/Update.cc +++ b/proxy/Update.cc @@ -875,7 +875,7 @@ UpdateConfigList * UpdateConfigManager::BuildUpdateList() { // Build pathname to "update.config" and open file - xptr<char> config_path; + ats_scoped_str config_path; if (_filename) { config_path = Layout::get()->relative_to(Layout::get()->sysconfdir, _filename); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/http/HttpBodyFactory.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc index 839c476..e7f9703 100644 --- a/proxy/http/HttpBodyFactory.cc +++ b/proxy/http/HttpBodyFactory.cc @@ -297,7 +297,7 @@ HttpBodyFactory::reconfigure() all_found = all_found && (rec_err == REC_ERR_OKAY); Debug("body_factory", "response_suppression_mode = %d (found = %" PRId64")", response_suppression_mode, e); - xptr<char> directory_of_template_sets; + ats_scoped_str directory_of_template_sets; rec_err = RecGetRecordString_Xmalloc("proxy.config.body_factory.template_sets_dir", &s); all_found = all_found && (rec_err == REC_ERR_OKAY); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/http/remap/RemapConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc index e09531b..a713da4 100644 --- a/proxy/http/remap/RemapConfig.cc +++ b/proxy/http/remap/RemapConfig.cc @@ -248,7 +248,7 @@ parse_include_directive(const char * directive, BUILD_TABLE_INFO * bti, char * e // to keep the ACL rules from the parent because ACLs must be global across the full set of config // files. BUILD_TABLE_INFO nbti; - xptr<char> path; + ats_scoped_str path; bool success; // The included path is relative to SYSCONFDIR, just like remap.config is. @@ -883,7 +883,7 @@ remap_parse_config_bti(const char * path, BUILD_TABLE_INFO * bti) bool is_cur_mapping_regex; const char *type_id_str; - xptr<char> file_buf(readIntoBuffer(path, modulePrefix, NULL)); + ats_scoped_str file_buf(readIntoBuffer(path, modulePrefix, NULL)); if (!file_buf) { Warning("can't load remapping configuration file %s", path); return false; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/logging/LogConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc index 3246ff2..297f7f2 100644 --- a/proxy/logging/LogConfig.cc +++ b/proxy/logging/LogConfig.cc @@ -1616,7 +1616,7 @@ static char xml_config_buffer[] = "<LogFilter> \ void LogConfig::read_xml_log_config(int from_memory) { - xptr<char> config_path; + ats_scoped_str config_path; if (!from_memory) { if (xml_config_file == NULL) { @@ -2224,7 +2224,7 @@ LogConfig::read_xml_log_config(int from_memory) char ** LogConfig::read_log_hosts_file(size_t * num_hosts) { - xptr<char> config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, hosts_config_file)); + ats_scoped_str config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, hosts_config_file)); char line[LOG_MAX_FORMAT_LINE]; char **hosts = NULL; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7bb4e9bf/proxy/shared/DiagsConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc index d161ebc..f05c9ff 100644 --- a/proxy/shared/DiagsConfig.cc +++ b/proxy/shared/DiagsConfig.cc @@ -276,7 +276,7 @@ DiagsConfig::RegisterDiagConfig() DiagsConfig::DiagsConfig(const char * filename, const char * tags, const char * actions, bool use_records) { char diags_logpath[PATH_NAME_MAX + 1]; - xptr<char> logpath; + ats_scoped_str logpath; callbacks_established = false; diags_log_fp = (FILE *) NULL;
