mirror of
https://github.com/oatpp/oatpp.git
synced 2025-02-11 17:20:52 +08:00
minor code cleanup
This commit is contained in:
parent
50277add6b
commit
eb17e0c257
@ -57,11 +57,8 @@ add_library(oatpp
|
|||||||
oatpp/core/base/memory/MemoryPool.hpp
|
oatpp/core/base/memory/MemoryPool.hpp
|
||||||
oatpp/core/base/memory/ObjectPool.cpp
|
oatpp/core/base/memory/ObjectPool.cpp
|
||||||
oatpp/core/base/memory/ObjectPool.hpp
|
oatpp/core/base/memory/ObjectPool.hpp
|
||||||
oatpp/core/collection/FastQueue.cpp
|
|
||||||
oatpp/core/collection/FastQueue.hpp
|
oatpp/core/collection/FastQueue.hpp
|
||||||
oatpp/core/collection/LinkedList.cpp
|
|
||||||
oatpp/core/collection/LinkedList.hpp
|
oatpp/core/collection/LinkedList.hpp
|
||||||
oatpp/core/collection/ListMap.cpp
|
|
||||||
oatpp/core/collection/ListMap.hpp
|
oatpp/core/collection/ListMap.hpp
|
||||||
oatpp/core/concurrency/SpinLock.cpp
|
oatpp/core/concurrency/SpinLock.cpp
|
||||||
oatpp/core/concurrency/SpinLock.hpp
|
oatpp/core/concurrency/SpinLock.hpp
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* Project _____ __ ____ _ _
|
|
||||||
* ( _ ) /__\ (_ _)_| |_ _| |_
|
|
||||||
* )(_)( /(__)\ )( (_ _)(_ _)
|
|
||||||
* (_____)(__)(__)(__) |_| |_|
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright 2018-present, Leonid Stryzhevskyi <lganzzzo@gmail.com>
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "FastQueue.hpp"
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* Project _____ __ ____ _ _
|
|
||||||
* ( _ ) /__\ (_ _)_| |_ _| |_
|
|
||||||
* )(_)( /(__)\ )( (_ _)(_ _)
|
|
||||||
* (_____)(__)(__)(__) |_| |_|
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright 2018-present, Leonid Stryzhevskyi <lganzzzo@gmail.com>
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "LinkedList.hpp"
|
|
||||||
|
|
@ -86,29 +86,6 @@ private:
|
|||||||
oatpp::base::memory::MemoryPool::free(node);
|
oatpp::base::memory::MemoryPool::free(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedListNode* getNode(v_int32 index) const{
|
|
||||||
|
|
||||||
if(index >= m_count){
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
v_int32 i = 0;
|
|
||||||
LinkedListNode* curr = m_first;
|
|
||||||
|
|
||||||
while(curr != nullptr){
|
|
||||||
|
|
||||||
if(i == index){
|
|
||||||
return curr;
|
|
||||||
}
|
|
||||||
|
|
||||||
curr = curr->next;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LinkedList()
|
LinkedList()
|
||||||
@ -219,6 +196,29 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinkedListNode* getNode(v_int32 index) const {
|
||||||
|
|
||||||
|
if(index >= m_count){
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
v_int32 i = 0;
|
||||||
|
LinkedListNode* curr = m_first;
|
||||||
|
|
||||||
|
while(curr != nullptr){
|
||||||
|
|
||||||
|
if(i == index){
|
||||||
|
return curr;
|
||||||
|
}
|
||||||
|
|
||||||
|
curr = curr->next;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
LinkedListNode* getFirstNode() const {
|
LinkedListNode* getFirstNode() const {
|
||||||
return m_first;
|
return m_first;
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
*
|
|
||||||
* Project _____ __ ____ _ _
|
|
||||||
* ( _ ) /__\ (_ _)_| |_ _| |_
|
|
||||||
* )(_)( /(__)\ )( (_ _)(_ _)
|
|
||||||
* (_____)(__)(__)(__) |_| |_|
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright 2018-present, Leonid Stryzhevskyi <lganzzzo@gmail.com>
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include "ListMap.hpp"
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -170,6 +171,7 @@ void Connection::setStreamIOMode(oatpp::data::stream::IOMode ioMode) {
|
|||||||
m_mode = data::stream::NON_BLOCKING;
|
m_mode = data::stream::NON_BLOCKING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void Connection::setStreamIOMode(oatpp::data::stream::IOMode ioMode) {
|
void Connection::setStreamIOMode(oatpp::data::stream::IOMode ioMode) {
|
||||||
@ -233,7 +235,7 @@ oatpp::async::Action Connection::suggestOutputStreamAction(data::v_io_size ioRes
|
|||||||
return oatpp::async::Action::createIORepeatAction(m_handle, oatpp::async::Action::IOEventType::IO_EVENT_WRITE);
|
return oatpp::async::Action::createIORepeatAction(m_handle, oatpp::async::Action::IOEventType::IO_EVENT_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("[oatpp::network::virtual_::Pipe::Reader::suggestInputStreamAction()]: Error. Unable to suggest async action for I/O result.");
|
throw std::runtime_error("[oatpp::network::Connection::suggestInputStreamAction()]: Error. Unable to suggest async action for I/O result.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +252,7 @@ oatpp::async::Action Connection::suggestInputStreamAction(data::v_io_size ioResu
|
|||||||
return oatpp::async::Action::createIORepeatAction(m_handle, oatpp::async::Action::IOEventType::IO_EVENT_READ);
|
return oatpp::async::Action::createIORepeatAction(m_handle, oatpp::async::Action::IOEventType::IO_EVENT_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error("[oatpp::network::virtual_::Pipe::Reader::suggestInputStreamAction()]: Error. Unable to suggest async action for I/O result.");
|
throw std::runtime_error("[oatpp::network::Connection::suggestInputStreamAction()]: Error. Unable to suggest async action for I/O result.");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "oatpp/core/utils/ConversionUtils.hpp"
|
#include "oatpp/core/utils/ConversionUtils.hpp"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
|
@ -25,10 +25,10 @@
|
|||||||
#include "./SimpleTCPConnectionProvider.hpp"
|
#include "./SimpleTCPConnectionProvider.hpp"
|
||||||
|
|
||||||
#include "oatpp/network/Connection.hpp"
|
#include "oatpp/network/Connection.hpp"
|
||||||
|
|
||||||
#include "oatpp/core/utils/ConversionUtils.hpp"
|
#include "oatpp/core/utils/ConversionUtils.hpp"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user