Repository: trafficserver Updated Branches: refs/heads/master 23263bf8b -> 7643ccd17
TS-4132: Replace nullptr with NULL Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7643ccd1 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7643ccd1 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7643ccd1 Branch: refs/heads/master Commit: 7643ccd17a720a26cd13768296cf78f9c23f160d Parents: 23263bf Author: Bryan Call <[email protected]> Authored: Thu Feb 11 17:51:12 2016 -0800 Committer: Bryan Call <[email protected]> Committed: Thu Feb 11 17:51:12 2016 -0800 ---------------------------------------------------------------------- plugins/experimental/inliner/ats-inliner.cc | 28 ++--- plugins/experimental/inliner/cache-handler.h | 36 +++---- plugins/experimental/inliner/cache.cc | 18 ++-- plugins/experimental/inliner/cache.h | 18 ++-- plugins/experimental/inliner/inliner-handler.cc | 14 +-- plugins/experimental/inliner/inliner-handler.h | 2 +- plugins/experimental/inliner/ts.cc | 108 +++++++++---------- plugins/experimental/inliner/ts.h | 26 ++--- plugins/experimental/inliner/vconnection.h | 14 +-- 9 files changed, 132 insertions(+), 132 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/ats-inliner.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/ats-inliner.cc b/plugins/experimental/inliner/ats-inliner.cc index 773607b..8da0089 100644 --- a/plugins/experimental/inliner/ats-inliner.cc +++ b/plugins/experimental/inliner/ats-inliner.cc @@ -44,8 +44,8 @@ struct MyData { MyData(const TSIOBufferReader r, const TSVConn v) : handler(r, ats::io::IOSink::Create(TSTransformOutputVConnGet(v), TSContMutexGet(v), timeout)) { - assert(r != nullptr); - assert(v != nullptr); + assert(r != NULL); + assert(v != NULL); } }; @@ -58,7 +58,7 @@ handle_transform(const TSCont c) if (!TSVIOBufferGet(vio)) { TSVConnShutdown(c, 1, 0); - TSContDataSet(c, nullptr); + TSContDataSet(c, NULL); delete data; return; } @@ -89,7 +89,7 @@ handle_transform(const TSCont c) } else { TSContCall(TSVIOContGet(vio), TS_EVENT_VCONN_WRITE_COMPLETE, vio); TSVConnShutdown(c, 1, 0); - TSContDataSet(c, nullptr); + TSContDataSet(c, NULL); delete data; } } @@ -100,8 +100,8 @@ null_transform(TSCont c, TSEvent e, void *) if (TSVConnClosedGet(c)) { TSDebug(PLUGIN_TAG, "connection closed"); MyData *const data = static_cast<MyData *>(TSContDataGet(c)); - if (data != nullptr) { - TSContDataSet(c, nullptr); + if (data != NULL) { + TSContDataSet(c, NULL); data->handler.abort(); delete data; } @@ -110,7 +110,7 @@ null_transform(TSCont c, TSEvent e, void *) switch (e) { case TS_EVENT_ERROR: { const TSVIO vio = TSVConnWriteVIOGet(c); - assert(vio != nullptr); + assert(vio != NULL); TSContCall(TSVIOContGet(vio), TS_EVENT_ERROR, vio); } break; @@ -134,8 +134,8 @@ transformable(TSHttpTxn txnp) TSMBuffer buffer; TSMLoc location; CHECK(TSHttpTxnServerRespGet(txnp, &buffer, &location)); - assert(buffer != nullptr); - assert(location != nullptr); + assert(buffer != NULL); + assert(location != NULL); returnValue = TSHttpHdrStatusGet(buffer, location) == TS_HTTP_STATUS_OK; @@ -147,7 +147,7 @@ transformable(TSHttpTxn txnp) int length = 0; const char *const content = TSMimeHdrFieldValueStringGet(buffer, location, field, 0, &length); - if (content != nullptr && length > 0) { + if (content != NULL && length > 0) { returnValue = strncasecmp(content, "text/html", 9) == 0; } @@ -164,9 +164,9 @@ transformable(TSHttpTxn txnp) void transform_add(const TSHttpTxn t) { - assert(t != nullptr); + assert(t != NULL); const TSVConn vconnection = TSTransformCreate(null_transform, t); - assert(vconnection != nullptr); + assert(vconnection != NULL); TSHttpTxnHookAdd(t, TS_HTTP_RESPONSE_TRANSFORM_HOOK, vconnection); } @@ -174,7 +174,7 @@ int transform_plugin(TSCont, TSEvent e, void *d) { assert(TS_EVENT_HTTP_READ_RESPONSE_HDR == e); - assert(d != nullptr); + assert(d != NULL); const TSHttpTxn transaction = static_cast<TSHttpTxn>(d); @@ -209,7 +209,7 @@ TSPluginInit(int, const char **) goto error; } - TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(transform_plugin, nullptr)); + TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(transform_plugin, NULL)); return; error: http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/cache-handler.h ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/cache-handler.h b/plugins/experimental/inliner/cache-handler.h index 97a3784..467c089 100644 --- a/plugins/experimental/inliner/cache-handler.h +++ b/plugins/experimental/inliner/cache-handler.h @@ -52,10 +52,10 @@ getHeader(TSMBuffer buffer, TSMLoc location, const std::string &name, std::strin { bool result = false; const TSMLoc field = TSMimeHdrFieldFind(buffer, location, name.c_str(), name.size()); - if (field != nullptr) { + if (field != NULL) { int length = 0; const char *const content = TSMimeHdrFieldValueStringGet(buffer, location, field, -1, &length); - if (content != nullptr && length > 0) { + if (content != NULL && length > 0) { value = std::string(content, length); result = true; } @@ -75,7 +75,7 @@ namespace inliner int64_t data(const TSIOBufferReader r, int64_t l) { - assert(r != nullptr); + assert(r != NULL); TSIOBufferBlock block = TSIOBufferReaderStart(r); assert(l >= 0); @@ -89,7 +89,7 @@ namespace inliner for (; block && l > 0; block = TSIOBufferBlockNext(block)) { int64_t size = 0; const char *const pointer = TSIOBufferBlockReadStart(block, r, &size); - if (pointer != nullptr && size > 0) { + if (pointer != NULL && size > 0) { size = std::min(size, l); std::copy(pointer, pointer + size, std::back_inserter(content_)); length += size; @@ -180,7 +180,7 @@ namespace inliner uint64_t read(const TSIOBufferReader &r, std::string &o, int64_t l = 0) { - assert(r != nullptr); + assert(r != NULL); TSIOBufferBlock block = TSIOBufferReaderStart(r); assert(l >= 0); @@ -194,7 +194,7 @@ namespace inliner for (; block && l > 0; block = TSIOBufferBlockNext(block)) { int64_t size = 0; const char *const pointer = TSIOBufferBlockReadStart(block, r, &size); - if (pointer != nullptr && size > 0) { + if (pointer != NULL && size > 0) { size = std::min(size, l); o.append(pointer, size); length += size; @@ -216,27 +216,27 @@ namespace inliner ~CacheHandler() { - if (reader_ != nullptr) { + if (reader_ != NULL) { TSIOBufferReaderConsume(reader_, TSIOBufferReaderAvail(reader_)); assert(TSIOBufferReaderAvail(reader_) == 0); TSIOBufferReaderFree(reader_); - reader_ = nullptr; + reader_ = NULL; } } template <class T1, class T2> CacheHandler(const std::string &s, const std::string &o, const std::string c, const std::string &i, T1 &&si, T2 &&si2) - : src_(s), original_(o), classes_(c), id_(i), sink_(std::forward<T1>(si)), sink2_(std::forward<T2>(si2)), reader_(nullptr) + : src_(s), original_(o), classes_(c), id_(i), sink_(std::forward<T1>(si)), sink2_(std::forward<T2>(si2)), reader_(NULL) { - assert(sink_ != nullptr); - assert(sink2_ != nullptr); + assert(sink_ != NULL); + assert(sink2_ != NULL); } CacheHandler(CacheHandler &&h) : src_(std::move(h.src_)), original_(std::move(h.original_)), classes_(std::move(h.classes_)), id_(std::move(h.id_)), sink_(std::move(h.sink_)), sink2_(std::move(h.sink2_)), reader_(h.reader_) { - h.reader_ = nullptr; + h.reader_ = NULL; } CacheHandler(const CacheHandler &) = delete; @@ -245,8 +245,8 @@ namespace inliner void done(void) { - assert(reader_ != nullptr); - assert(sink2_ != nullptr); + assert(reader_ != NULL); + assert(sink2_ != NULL); std::string o; read(reader_, o); o = "<script>h(\"" + id_ + "\",\"" + o + "\");</script>"; @@ -257,7 +257,7 @@ namespace inliner data(TSIOBufferReader r) { // TODO(dmorilha): API maybe address as a different single event? - if (reader_ == nullptr) { + if (reader_ == NULL) { reader_ = TSIOBufferReaderClone(r); } } @@ -265,7 +265,7 @@ namespace inliner void hit(TSVConn v) { - assert(v != nullptr); + assert(v != NULL); TSDebug(PLUGIN_TAG, "cache hit for %s (%" PRId64 " bytes)", src_.c_str(), TSVConnCacheObjectSizeGet(v)); @@ -288,7 +288,7 @@ namespace inliner void miss(void) { - assert(sink_ != nullptr); + assert(sink_ != NULL); *sink_ << original_; if (!src_.empty()) { *sink_ << "src=\"" << src_ << "\" "; @@ -298,7 +298,7 @@ namespace inliner } sink_.reset(); - assert(sink2_ != nullptr); + assert(sink2_ != NULL); sink2_.reset(); const std::string b; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/cache.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/cache.cc b/plugins/experimental/inliner/cache.cc index cb6ad6f..9ed69a0 100644 --- a/plugins/experimental/inliner/cache.cc +++ b/plugins/experimental/inliner/cache.cc @@ -34,8 +34,8 @@ namespace cache write(const std::string &k, std::string &&s) { Key key(k); - TSCont continuation = TSContCreate(Write::handle, nullptr); - assert(continuation != nullptr); + TSCont continuation = TSContCreate(Write::handle, NULL); + assert(continuation != NULL); TSContDataSet(continuation, new Write(std::move(s))); TSCacheWrite(continuation, key.key()); } @@ -43,28 +43,28 @@ namespace cache int Write::handle(TSCont c, TSEvent e, void *v) { - assert(c != nullptr); + assert(c != NULL); Write *const self = static_cast<Write *>(TSContDataGet(c)); - assert(self != nullptr); + assert(self != NULL); switch (e) { case TS_EVENT_CACHE_OPEN_WRITE: - assert(v != nullptr); + assert(v != NULL); self->vconnection_ = static_cast<TSVConn>(v); - assert(self->out_ == nullptr); + assert(self->out_ == NULL); self->out_ = io::IO::write(self->vconnection_, c, self->content_.size()); break; case TS_EVENT_CACHE_OPEN_WRITE_FAILED: TSDebug(PLUGIN_TAG, "write failed"); delete self; - TSContDataSet(c, nullptr); + TSContDataSet(c, NULL); TSContDestroy(c); break; case TS_EVENT_VCONN_WRITE_COMPLETE: TSDebug(PLUGIN_TAG, "write completed"); - assert(self->vconnection_ != nullptr); + assert(self->vconnection_ != NULL); TSVConnClose(self->vconnection_); delete self; - TSContDataSet(c, nullptr); + TSContDataSet(c, NULL); TSContDestroy(c); break; case TS_EVENT_VCONN_WRITE_READY: http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/cache.h ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/cache.h b/plugins/experimental/inliner/cache.h index c5c1133..c67fe85 100644 --- a/plugins/experimental/inliner/cache.h +++ b/plugins/experimental/inliner/cache.h @@ -36,17 +36,17 @@ namespace cache struct Key { ~Key() { - assert(key_ != nullptr); + assert(key_ != NULL); TSCacheKeyDestroy(key_); } - Key(void) : key_(TSCacheKeyCreate()) { assert(key_ != nullptr); } + Key(void) : key_(TSCacheKeyCreate()) { assert(key_ != NULL); } Key(const Key &) = delete; Key &operator=(const Key &) = delete; explicit Key(const std::string &s) : key_(TSCacheKeyCreate()) { - assert(key_ != nullptr); + assert(key_ != NULL); CHECK(TSCacheKeyDigestSet(key_, s.c_str(), s.size())); } @@ -69,10 +69,10 @@ namespace cache handle(TSCont c, TSEvent e, void *d) { Self *const self = static_cast<Self *const>(TSContDataGet(c)); - assert(self != nullptr); + assert(self != NULL); switch (e) { case TS_EVENT_CACHE_OPEN_READ: - assert(d != nullptr); + assert(d != NULL); self->t_.hit(static_cast<TSVConn>(d)); break; case TS_EVENT_CACHE_OPEN_READ_FAILED: @@ -83,7 +83,7 @@ namespace cache break; } delete self; - TSContDataSet(c, nullptr); + TSContDataSet(c, NULL); TSContDestroy(c); return TS_SUCCESS; } @@ -95,7 +95,7 @@ namespace cache { const Key key(k); const TSCont continuation = TSContCreate(Read<T>::handle, TSMutexCreate()); - assert(continuation != nullptr); + assert(continuation != NULL); TSContDataSet(continuation, new Read<T>(std::forward<A>(a)...)); TSCacheRead(continuation, key.key()); } @@ -107,12 +107,12 @@ namespace cache ~Write() { - if (out_ != nullptr) { + if (out_ != NULL) { delete out_; } } - Write(std::string &&s) : content_(std::move(s)), out_(nullptr), vconnection_(nullptr) {} + Write(std::string &&s) : content_(std::move(s)), out_(NULL), vconnection_(NULL) {} static int handle(TSCont, TSEvent, void *); }; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/inliner-handler.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/inliner-handler.cc b/plugins/experimental/inliner/inliner-handler.cc index ab5342a..8037b06 100644 --- a/plugins/experimental/inliner/inliner-handler.cc +++ b/plugins/experimental/inliner/inliner-handler.cc @@ -40,7 +40,7 @@ namespace inliner assert(sink_->data_); assert(sink2_); assert(sink2_->data_); - assert(reader_ != nullptr); + assert(reader_ != NULL); *sink_ << "<script>" "var a=document,b=a.getElementsByTagName(\"img\"),c=b.length,w=window,d=function(){var " "m=w.addEventListener,n=w.attachEvent;return " @@ -69,13 +69,13 @@ namespace inliner void Handler::parse(void) { - assert(reader_ != nullptr); + assert(reader_ != NULL); TSIOBufferBlock block = TSIOBufferReaderStart(reader_); int64_t offset = 0; - while (block != nullptr) { + while (block != NULL) { int64_t length = 0; const char *const buffer = TSIOBufferBlockReadStart(block, reader_, &length); - assert(buffer != nullptr); + assert(buffer != NULL); if (length > 0) { HtmlParser::parse(buffer, length, offset); offset += length; @@ -119,12 +119,12 @@ namespace inliner } } - assert(sink_ != nullptr); - assert(sink2_ != nullptr); + assert(sink_ != NULL); + assert(sink2_ != NULL); src.erase(src.find('#')); cache::fetch<CacheHandler>(src + VERSION, src, original, classes, generateId(), sink2_->branch(), sink_); } else { - assert(sink2_ != nullptr); + assert(sink2_ != NULL); *sink2_ << " " << static_cast<std::string>(a); } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/inliner-handler.h ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/inliner-handler.h b/plugins/experimental/inliner/inliner-handler.h index 3ec5602..d7caba1 100644 --- a/plugins/experimental/inliner/inliner-handler.h +++ b/plugins/experimental/inliner/inliner-handler.h @@ -41,7 +41,7 @@ namespace inliner ~Handler() { - assert(reader_ != nullptr); + assert(reader_ != NULL); const int64_t available = TSIOBufferReaderAvail(reader_); if (available > 0) { TSIOBufferReaderConsume(reader_, available); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/ts.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/ts.cc b/plugins/experimental/inliner/ts.cc index 50d5aa8..8aa2686 100644 --- a/plugins/experimental/inliner/ts.cc +++ b/plugins/experimental/inliner/ts.cc @@ -51,7 +51,7 @@ namespace io uint64_t IO::copy(const std::string &s) const { - assert(buffer != nullptr); + assert(buffer != NULL); const uint64_t size = TSIOBufferWrite(buffer, s.data(), s.size()); assert(size == s.size()); return size; @@ -80,45 +80,45 @@ namespace io WriteOperation::~WriteOperation() { - assert(mutex_ != nullptr); + assert(mutex_ != NULL); const Lock lock(mutex_); TSDebug(PLUGIN_TAG, "~WriteOperation"); - vio_ = nullptr; + vio_ = NULL; - if (action_ != nullptr) { + if (action_ != NULL) { TSActionCancel(action_); } - assert(reader_ != nullptr); + assert(reader_ != NULL); TSIOBufferReaderFree(reader_); - assert(buffer_ != nullptr); + assert(buffer_ != NULL); TSIOBufferDestroy(buffer_); - assert(continuation_ != nullptr); + assert(continuation_ != NULL); TSContDestroy(continuation_); - assert(vconnection_ != nullptr); + assert(vconnection_ != NULL); TSVConnShutdown(vconnection_, 0, 1); } WriteOperation::WriteOperation(const TSVConn v, const TSMutex m, const size_t t) : vconnection_(v), buffer_(TSIOBufferCreate()), reader_(TSIOBufferReaderAlloc(buffer_)), - mutex_(m != nullptr ? m : TSMutexCreate()), continuation_(TSContCreate(WriteOperation::Handle, mutex_)), - vio_(TSVConnWrite(v, continuation_, reader_, std::numeric_limits<int64_t>::max())), action_(nullptr), timeout_(t), bytes_(0), + mutex_(m != NULL ? m : TSMutexCreate()), continuation_(TSContCreate(WriteOperation::Handle, mutex_)), + vio_(TSVConnWrite(v, continuation_, reader_, std::numeric_limits<int64_t>::max())), action_(NULL), timeout_(t), bytes_(0), reenable_(true) { - assert(vconnection_ != nullptr); - assert(buffer_ != nullptr); - assert(reader_ != nullptr); - assert(mutex_ != nullptr); - assert(continuation_ != nullptr); - assert(vio_ != nullptr); + assert(vconnection_ != NULL); + assert(buffer_ != NULL); + assert(reader_ != NULL); + assert(mutex_ != NULL); + assert(continuation_ != NULL); + assert(vio_ != NULL); if (timeout_ > 0) { action_ = TSContSchedule(continuation_, timeout_, TS_THREAD_POOL_DEFAULT); - assert(action_ != nullptr); + assert(action_ != NULL); } } @@ -128,37 +128,37 @@ namespace io assert(mutex_); const Lock lock(mutex_); bytes_ += b; - if (vio_ != nullptr && TSVIOContGet(vio_) != nullptr) { + if (vio_ != NULL && TSVIOContGet(vio_) != NULL) { if (reenable_) { TSVIOReenable(vio_); reenable_ = false; } } else { - vio_ = nullptr; + vio_ = NULL; } } int WriteOperation::Handle(const TSCont c, const TSEvent e, void *d) { - assert(c != nullptr); + assert(c != NULL); WriteOperationPointer *const p = static_cast<WriteOperationPointer *>(TSContDataGet(c)); if (TS_EVENT_VCONN_WRITE_COMPLETE == e) { TSDebug(PLUGIN_TAG, "TS_EVENT_VCONN_WRITE_COMPLETE"); - if (p != nullptr) { - TSContDataSet(c, nullptr); + if (p != NULL) { + TSContDataSet(c, NULL); delete p; } return TS_SUCCESS; } - assert(p != nullptr); + assert(p != NULL); assert(*p); WriteOperation &operation = **p; assert(operation.continuation_ == c); - assert(operation.vconnection_ != nullptr); - assert(d != nullptr); + assert(operation.vconnection_ != NULL); + assert(d != NULL); assert(TS_EVENT_ERROR == e || TS_EVENT_TIMEOUT == e || TS_EVENT_VCONN_WRITE_READY == e); switch (e) { @@ -171,11 +171,11 @@ namespace io handle_error: operation.close(); - assert(operation.action_ != nullptr); + assert(operation.action_ != NULL); TSActionDone(operation.action_); - operation.action_ = nullptr; + operation.action_ = NULL; /* - TSContDataSet(c, nullptr); + TSContDataSet(c, NULL); delete p; */ break; @@ -196,9 +196,9 @@ namespace io WriteOperation::Create(const TSVConn v, const TSMutex m, const size_t t) { WriteOperation *const operation = new WriteOperation(v, m, t); - assert(operation != nullptr); + assert(operation != NULL); WriteOperationPointer *const pointer = new WriteOperationPointer(operation); - assert(pointer != nullptr); + assert(pointer != NULL); TSContDataSet(operation->continuation_, pointer); #ifndef NDEBUG @@ -214,28 +214,28 @@ namespace io WriteOperation &WriteOperation::operator<<(const TSIOBufferReader r) { - assert(r != nullptr); + assert(r != NULL); process(TSIOBufferCopy(buffer_, r, TSIOBufferReaderAvail(r), 0)); return *this; } WriteOperation &WriteOperation::operator<<(const ReaderSize &r) { - assert(r.reader != nullptr); + assert(r.reader != NULL); process(TSIOBufferCopy(buffer_, r.reader, r.size, r.offset)); return *this; } WriteOperation &WriteOperation::operator<<(const ReaderOffset &r) { - assert(r.reader != nullptr); + assert(r.reader != NULL); process(TSIOBufferCopy(buffer_, r.reader, TSIOBufferReaderAvail(r.reader), r.offset)); return *this; } WriteOperation &WriteOperation::operator<<(const char *const s) { - assert(s != nullptr); + assert(s != NULL); process(TSIOBufferWrite(buffer_, s, strlen(s))); return *this; } @@ -249,21 +249,21 @@ namespace io void WriteOperation::close(void) { - assert(mutex_ != nullptr); + assert(mutex_ != NULL); const Lock lock(mutex_); - if (vio_ != nullptr && TSVIOContGet(vio_) != nullptr) { + if (vio_ != NULL && TSVIOContGet(vio_) != NULL) { TSVIONBytesSet(vio_, bytes_); TSVIOReenable(vio_); } - vio_ = nullptr; + vio_ = NULL; } void WriteOperation::abort(void) { - assert(mutex_ != nullptr); + assert(mutex_ != NULL); const Lock lock(mutex_); - vio_ = nullptr; + vio_ = NULL; } IOSink::~IOSink() @@ -285,10 +285,10 @@ namespace io return; } - assert(operation->mutex_ != nullptr); + assert(operation->mutex_ != NULL); const Lock lock(operation->mutex_); - assert(operation->buffer_ != nullptr); + assert(operation->buffer_ != NULL); const Node::Result result = data_->process(operation->buffer_); operation->bytes_ += result.first; operation->process(); @@ -306,8 +306,8 @@ namespace io return Lock(); } - assert(operation != nullptr); - assert(operation->mutex_ != nullptr); + assert(operation != NULL); + assert(operation->mutex_ != NULL); return Lock(operation->mutex_); } @@ -323,28 +323,28 @@ namespace io BufferNode &BufferNode::operator<<(const TSIOBufferReader r) { - assert(r != nullptr); + assert(r != NULL); TSIOBufferCopy(buffer_, r, TSIOBufferReaderAvail(r), 0); return *this; } BufferNode &BufferNode::operator<<(const ReaderSize &r) { - assert(r.reader != nullptr); + assert(r.reader != NULL); TSIOBufferCopy(buffer_, r.reader, r.size, r.offset); return *this; } BufferNode &BufferNode::operator<<(const ReaderOffset &r) { - assert(r.reader != nullptr); + assert(r.reader != NULL); TSIOBufferCopy(buffer_, r.reader, TSIOBufferReaderAvail(r.reader), r.offset); return *this; } BufferNode &BufferNode::operator<<(const char *const s) { - assert(s != nullptr); + assert(s != NULL); TSIOBufferWrite(buffer_, s, strlen(s)); return *this; } @@ -358,9 +358,9 @@ namespace io Node::Result BufferNode::process(const TSIOBuffer b) { - assert(b != nullptr); - assert(buffer_ != nullptr); - assert(reader_ != nullptr); + assert(b != NULL); + assert(buffer_ != NULL); + assert(reader_ != NULL); const size_t available = TSIOBufferReaderAvail(reader_); const size_t copied = TSIOBufferCopy(b, reader_, available, 0); assert(copied == available); @@ -372,7 +372,7 @@ namespace io Node::Result StringNode::process(const TSIOBuffer b) { - assert(b != nullptr); + assert(b != NULL); const size_t copied = TSIOBufferWrite(b, string_.data(), string_.size()); assert(copied == string_.size()); return Node::Result(copied, true); @@ -421,7 +421,7 @@ namespace io Node::Result Data::process(const TSIOBuffer b) { - assert(b != nullptr); + assert(b != NULL); int64_t length = 0; const Nodes::iterator begin = nodes_.begin(), end = nodes_.end(); @@ -429,7 +429,7 @@ namespace io Nodes::iterator it = begin; for (; it != end; ++it) { - assert(*it != nullptr); + assert(*it != NULL); const Node::Result result = (*it)->process(b); length += result.first; if (!result.second || !it->unique()) { @@ -444,7 +444,7 @@ namespace io nodes_.erase(begin, it); if (it != end) { Data *data = dynamic_cast<Data *>(it->get()); - while (data != nullptr) { + while (data != NULL) { // TSDebug(PLUGIN_TAG, "new first"); data->first_ = true; if (data->nodes_.empty()) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/ts.h ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/ts.h b/plugins/experimental/inliner/ts.h index 704c0a5..468eddf 100644 --- a/plugins/experimental/inliner/ts.h +++ b/plugins/experimental/inliner/ts.h @@ -118,22 +118,22 @@ namespace io ~Lock() { - if (mutex_ != nullptr) { + if (mutex_ != NULL) { TSMutexUnlock(mutex_); } } Lock(const TSMutex m) : mutex_(m) { - if (mutex_ != nullptr) { + if (mutex_ != NULL) { TSMutexLock(mutex_); } } - Lock(void) : mutex_(nullptr) {} + Lock(void) : mutex_(NULL) {} Lock(const Lock &) = delete; - Lock(Lock &&l) : mutex_(l.mutex_) { const_cast<TSMutex &>(l.mutex_) = nullptr; } + Lock(Lock &&l) : mutex_(l.mutex_) { const_cast<TSMutex &>(l.mutex_) = NULL; } Lock &operator=(const Lock &) = delete; }; @@ -150,7 +150,7 @@ namespace io bool reenable_; static int Handle(TSCont, TSEvent, void *); - static WriteOperationWeakPointer Create(const TSVConn, const TSMutex mutex = nullptr, const size_t timeout = 0); + static WriteOperationWeakPointer Create(const TSVConn, const TSMutex mutex = NULL, const size_t timeout = 0); ~WriteOperation(); @@ -238,16 +238,16 @@ namespace io ~BufferNode() { - assert(reader_ != nullptr); + assert(reader_ != NULL); TSIOBufferReaderFree(reader_); - assert(buffer_ != nullptr); + assert(buffer_ != NULL); TSIOBufferDestroy(buffer_); } BufferNode(void) : buffer_(TSIOBufferCreate()), reader_(TSIOBufferReaderAlloc(buffer_)) { - assert(buffer_ != nullptr); - assert(reader_ != nullptr); + assert(buffer_ != NULL); + assert(reader_ != NULL); } BufferNode(const BufferNode &) = delete; @@ -289,7 +289,7 @@ namespace io { if (data_) { const Lock lock = data_->root_->lock(); - assert(data_->root_ != nullptr); + assert(data_->root_ != NULL); const bool empty = data_->nodes_.empty(); if (data_->first_ && empty) { // TSDebug(PLUGIN_TAG, "flushing"); @@ -297,15 +297,15 @@ namespace io *data_->root_ << std::forward<T>(t); } else { // TSDebug(PLUGIN_TAG, "buffering"); - BufferNode *buffer = nullptr; + BufferNode *buffer = NULL; if (!empty) { buffer = dynamic_cast<BufferNode *>(data_->nodes_.back().get()); } - if (buffer == nullptr) { + if (buffer == NULL) { data_->nodes_.emplace_back(new BufferNode()); buffer = reinterpret_cast<BufferNode *>(data_->nodes_.back().get()); } - assert(buffer != nullptr); + assert(buffer != NULL); *buffer << std::forward<T>(t); } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7643ccd1/plugins/experimental/inliner/vconnection.h ---------------------------------------------------------------------- diff --git a/plugins/experimental/inliner/vconnection.h b/plugins/experimental/inliner/vconnection.h index 026c41f..fd2b730 100644 --- a/plugins/experimental/inliner/vconnection.h +++ b/plugins/experimental/inliner/vconnection.h @@ -42,9 +42,9 @@ namespace io Read(TSVConn v, T &&t, const int64_t s) : vconnection_(v), t_(std::forward<T>(t)) { - assert(vconnection_ != nullptr); - TSCont continuation = TSContCreate(Self::handleRead, nullptr); - assert(continuation != nullptr); + assert(vconnection_ != NULL); + TSCont continuation = TSContCreate(Self::handleRead, NULL); + assert(continuation != NULL); TSContDataSet(continuation, this); in_.vio = TSVConnRead(vconnection_, continuation, in_.buffer, s); } @@ -52,9 +52,9 @@ namespace io static void close(Self *const s) { - assert(s != nullptr); + assert(s != NULL); TSIOBufferReaderConsume(s->in_.reader, TSIOBufferReaderAvail(s->in_.reader)); - assert(s->vconnection_ != nullptr); + assert(s->vconnection_ != NULL); TSVConnShutdown(s->vconnection_, 1, 1); TSVConnClose(s->vconnection_); delete s; @@ -64,7 +64,7 @@ namespace io handleRead(TSCont c, TSEvent e, void *) { Self *const self = static_cast<Self *const>(TSContDataGet(c)); - assert(self != nullptr); + assert(self != NULL); switch (e) { case TS_EVENT_VCONN_EOS: case TS_EVENT_VCONN_READ_COMPLETE: @@ -77,7 +77,7 @@ namespace io if (e == TS_EVENT_VCONN_READ_COMPLETE || e == TS_EVENT_VCONN_EOS) { self->t_.done(); close(self); - TSContDataSet(c, nullptr); + TSContDataSet(c, NULL); TSContDestroy(c); } } break;
