mirror of https://gitee.com/bigwinds/arangodb
use nullptr
This commit is contained in:
parent
627343dde4
commit
b76cb5caee
|
@ -2321,21 +2321,21 @@ void IndexRangeBlock::readHashIndex (size_t atMost) {
|
|||
// only have equalities followed by a single arbitrary comparison (i.e x.a == 1
|
||||
// && x.b == 2 && x.c > 3 && x.c <= 4). Then we do:
|
||||
//
|
||||
// TRI_CreateIndexOperator(TRI_AND_INDEX_OPERATOR, left, right, NULL, shaper,
|
||||
// TRI_CreateIndexOperator(TRI_AND_INDEX_OPERATOR, left, right, nullptr, shaper,
|
||||
// 2);
|
||||
//
|
||||
// where
|
||||
//
|
||||
// left = TRI_CreateIndexOperator(TRI_GT_INDEX_OPERATOR, NULL, NULL, [1,2,3],
|
||||
// left = TRI_CreateIndexOperator(TRI_GT_INDEX_OPERATOR, nullptr, nullptr, [1,2,3],
|
||||
// shaper, 3)
|
||||
//
|
||||
// right = TRI_CreateIndexOperator(TRI_LE_INDEX_OPERATOR, NULL, NULL, [1,2,4],
|
||||
// right = TRI_CreateIndexOperator(TRI_LE_INDEX_OPERATOR, nullptr, nullptr, [1,2,4],
|
||||
// shaper, 3)
|
||||
//
|
||||
// If the final comparison is an equality (x.a == 1 && x.b == 2 && x.c ==3), then
|
||||
// we just do:
|
||||
//
|
||||
// TRI_CreateIndexOperator(TRI_EQ_INDEX_OPERATOR, NULL, NULL, [1,2,3],
|
||||
// TRI_CreateIndexOperator(TRI_EQ_INDEX_OPERATOR, nullptr, nullptr, [1,2,3],
|
||||
// shaper, 3)
|
||||
//
|
||||
// It is necessary that values of the attributes are listed in the correct
|
||||
|
|
|
@ -228,7 +228,9 @@ int usersOnCoordinator (std::string const& dbname,
|
|||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/simple/all",
|
||||
body,
|
||||
true,
|
||||
headers, NULL, 10.0);
|
||||
headers,
|
||||
nullptr,
|
||||
10.0);
|
||||
delete res;
|
||||
}
|
||||
|
||||
|
@ -309,7 +311,11 @@ int revisionOnCoordinator (std::string const& dbname,
|
|||
triagens::rest::HttpRequest::HTTP_REQUEST_GET,
|
||||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/collection/" +
|
||||
StringUtils::urlEncode(it->first) + "/revision",
|
||||
0, false, headers, NULL, 300.0);
|
||||
0,
|
||||
false,
|
||||
headers,
|
||||
nullptr,
|
||||
300.0);
|
||||
delete res;
|
||||
}
|
||||
|
||||
|
@ -392,7 +398,11 @@ int figuresOnCoordinator (string const& dbname,
|
|||
triagens::rest::HttpRequest::HTTP_REQUEST_GET,
|
||||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/collection/" +
|
||||
StringUtils::urlEncode(it->first) + "/figures",
|
||||
0, false, headers, NULL, 300.0);
|
||||
0,
|
||||
false,
|
||||
headers,
|
||||
nullptr,
|
||||
300.0);
|
||||
delete res;
|
||||
}
|
||||
|
||||
|
@ -487,7 +497,11 @@ int countOnCoordinator (
|
|||
triagens::rest::HttpRequest::HTTP_REQUEST_GET,
|
||||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/collection/" +
|
||||
StringUtils::urlEncode(it->first) + "/count",
|
||||
0, false, headers, NULL, 300.0);
|
||||
0,
|
||||
false,
|
||||
headers,
|
||||
nullptr,
|
||||
300.0);
|
||||
delete res;
|
||||
}
|
||||
// Now listen to the results:
|
||||
|
@ -736,8 +750,12 @@ int deleteDocumentOnCoordinator (
|
|||
triagens::rest::HttpRequest::HTTP_REQUEST_DELETE,
|
||||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/document/" +
|
||||
StringUtils::urlEncode(it->first) + "/" + StringUtils::urlEncode(key) +
|
||||
"?waitForSync=" + (waitForSync ? "true" : "false")+
|
||||
revstr + policystr, 0, false, headersCopy, NULL, 60.0);
|
||||
"?waitForSync=" + (waitForSync ? "true" : "false") + revstr + policystr,
|
||||
0,
|
||||
false,
|
||||
headersCopy,
|
||||
nullptr,
|
||||
60.0);
|
||||
delete res;
|
||||
}
|
||||
// Now listen to the results:
|
||||
|
@ -798,7 +816,11 @@ int truncateCollectionOnCoordinator ( string const& dbname,
|
|||
triagens::rest::HttpRequest::HTTP_REQUEST_PUT,
|
||||
"/_db/" + StringUtils::urlEncode(dbname) +
|
||||
"/_api/collection/" + it->first + "/truncate",
|
||||
0, false, headersCopy, NULL, 60.0);
|
||||
0,
|
||||
false,
|
||||
headersCopy,
|
||||
nullptr,
|
||||
60.0);
|
||||
delete res;
|
||||
}
|
||||
// Now listen to the results:
|
||||
|
@ -927,7 +949,12 @@ int getDocumentOnCoordinator (
|
|||
reqType,
|
||||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/document/"+
|
||||
StringUtils::urlEncode(it->first) + "/" + StringUtils::urlEncode(key) +
|
||||
revstr, 0, false, headersCopy, NULL, 60.0);
|
||||
revstr,
|
||||
0,
|
||||
false,
|
||||
headersCopy,
|
||||
nullptr,
|
||||
60.0);
|
||||
delete res;
|
||||
}
|
||||
// Now listen to the results:
|
||||
|
@ -1199,7 +1226,11 @@ int modifyDocumentOnCoordinator (
|
|||
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/document/"+
|
||||
StringUtils::urlEncode(it->first) + "/" + StringUtils::urlEncode(key) +
|
||||
"?waitForSync=" + (waitForSync ? "true" : "false") + revstr + policystr,
|
||||
&body, false, headersCopy, NULL, 60.0);
|
||||
&body,
|
||||
false,
|
||||
headersCopy,
|
||||
nullptr,
|
||||
60.0);
|
||||
delete res;
|
||||
}
|
||||
// Now listen to the results:
|
||||
|
@ -1353,7 +1384,12 @@ int flushWalOnAllDBServers (bool waitForSync, bool waitForCollector) {
|
|||
|
||||
res = cc->asyncRequest("", coordTransactionID, "server:" + *it,
|
||||
triagens::rest::HttpRequest::HTTP_REQUEST_PUT,
|
||||
url, body, true, headers, NULL, 120.0);
|
||||
url,
|
||||
body,
|
||||
true,
|
||||
headers,
|
||||
nullptr,
|
||||
120.0);
|
||||
delete res;
|
||||
}
|
||||
|
||||
|
|
|
@ -285,10 +285,10 @@ TRI_fulltext_list_t* TRI_UnioniseListFulltextIndex (TRI_fulltext_list_t* lhs,
|
|||
uint32_t numLhs, numRhs;
|
||||
uint32_t listPos;
|
||||
|
||||
if (lhs == NULL) {
|
||||
if (lhs == nullptr) {
|
||||
return rhs;
|
||||
}
|
||||
if (rhs == NULL) {
|
||||
if (rhs == nullptr) {
|
||||
return lhs;
|
||||
}
|
||||
|
||||
|
@ -307,10 +307,10 @@ TRI_fulltext_list_t* TRI_UnioniseListFulltextIndex (TRI_fulltext_list_t* lhs,
|
|||
}
|
||||
|
||||
list = TRI_CreateListFulltextIndex(numLhs + numRhs);
|
||||
if (list == NULL) {
|
||||
if (list == nullptr) {
|
||||
TRI_FreeListFulltextIndex(lhs);
|
||||
TRI_FreeListFulltextIndex(rhs);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SortList(lhs);
|
||||
|
@ -378,11 +378,11 @@ TRI_fulltext_list_t* TRI_IntersectListFulltextIndex (TRI_fulltext_list_t* lhs,
|
|||
uint32_t listPos;
|
||||
|
||||
// check if one of the pointers is NULL
|
||||
if (lhs == NULL) {
|
||||
if (lhs == nullptr) {
|
||||
return rhs;
|
||||
}
|
||||
|
||||
if (rhs == NULL) {
|
||||
if (rhs == nullptr) {
|
||||
return lhs;
|
||||
}
|
||||
|
||||
|
@ -393,10 +393,10 @@ TRI_fulltext_list_t* TRI_IntersectListFulltextIndex (TRI_fulltext_list_t* lhs,
|
|||
|
||||
// check the easy cases when one of the lists is empty
|
||||
if (numLhs == 0 || numRhs == 0) {
|
||||
if (lhs != NULL) {
|
||||
if (lhs != nullptr) {
|
||||
TRI_FreeListFulltextIndex(lhs);
|
||||
}
|
||||
if (rhs != NULL) {
|
||||
if (rhs != nullptr) {
|
||||
TRI_FreeListFulltextIndex(rhs);
|
||||
}
|
||||
|
||||
|
@ -406,10 +406,10 @@ TRI_fulltext_list_t* TRI_IntersectListFulltextIndex (TRI_fulltext_list_t* lhs,
|
|||
|
||||
// we have at least one entry in each list
|
||||
list = TRI_CreateListFulltextIndex(numLhs < numRhs ? numLhs : numRhs);
|
||||
if (list == NULL) {
|
||||
if (list == nullptr) {
|
||||
TRI_FreeListFulltextIndex(lhs);
|
||||
TRI_FreeListFulltextIndex(rhs);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SortList(lhs);
|
||||
|
@ -477,12 +477,12 @@ TRI_fulltext_list_t* TRI_ExcludeListFulltextIndex (TRI_fulltext_list_t* list,
|
|||
uint32_t numExclude;
|
||||
uint32_t i, j, listPos;
|
||||
|
||||
if (list == NULL) {
|
||||
if (list == nullptr) {
|
||||
TRI_FreeListFulltextIndex(exclude);
|
||||
return list;
|
||||
}
|
||||
|
||||
if (exclude == NULL) {
|
||||
if (exclude == nullptr) {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -576,8 +576,8 @@ TRI_fulltext_list_t* TRI_InsertListFulltextIndex (TRI_fulltext_list_t* list,
|
|||
|
||||
// increase the existing list
|
||||
clone = IncreaseList(list, newSize);
|
||||
if (clone == NULL) {
|
||||
return NULL;
|
||||
if (clone == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// switch over
|
||||
|
|
|
@ -40,19 +40,19 @@
|
|||
TRI_fulltext_result_t* TRI_CreateResultFulltextIndex (const uint32_t size) {
|
||||
TRI_fulltext_result_t* result = static_cast<TRI_fulltext_result_t*>(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_fulltext_result_t), false));
|
||||
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
if (result == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
result->_documents = NULL;
|
||||
result->_documents = nullptr;
|
||||
result->_numDocuments = 0;
|
||||
|
||||
if (size > 0) {
|
||||
result->_documents = static_cast<TRI_fulltext_doc_t*>(TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_fulltext_doc_t) * size, false));
|
||||
|
||||
if (result->_documents == NULL) {
|
||||
if (result->_documents == nullptr) {
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, result);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ TRI_fulltext_result_t* TRI_CreateResultFulltextIndex (const uint32_t size) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_DestroyResultFulltextIndex (TRI_fulltext_result_t* result) {
|
||||
if (result->_documents != NULL) {
|
||||
if (result->_documents != nullptr) {
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, result->_documents);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2603,7 +2603,7 @@ void RestReplicationHandler::handleCommandRestoreDataCoordinator () {
|
|||
"/_api/replication/restore-data?collection=" +
|
||||
it->first + forceopt,
|
||||
new string(bufs[j]->c_str(), bufs[j]->length()),
|
||||
true, headers, NULL, 300.0);
|
||||
true, headers, nullptr, 300.0);
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ static void InstallServiceCommand (std::string command) {
|
|||
<< "' (internal '" << ServiceName << "')"
|
||||
<< std::endl;
|
||||
|
||||
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
SC_HANDLE schSCManager = OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if (schSCManager == 0) {
|
||||
std::cerr << "FATAL: OpenSCManager failed with " << GetLastError() << std::endl;
|
||||
|
@ -105,11 +105,11 @@ static void InstallServiceCommand (std::string command) {
|
|||
SERVICE_AUTO_START, // start type
|
||||
SERVICE_ERROR_NORMAL, // error control type
|
||||
command.c_str(), // path to service's binary
|
||||
NULL, // no load ordering group
|
||||
NULL, // no tag identifier
|
||||
NULL, // no dependencies
|
||||
NULL, // account (LocalSystem)
|
||||
NULL); // password
|
||||
nullptr, // no load ordering group
|
||||
nullptr, // no tag identifier
|
||||
nullptr, // no dependencies
|
||||
nullptr, // account (LocalSystem)
|
||||
nullptr); // password
|
||||
|
||||
CloseServiceHandle(schSCManager);
|
||||
|
||||
|
@ -133,7 +133,7 @@ static void InstallServiceCommand (std::string command) {
|
|||
static void InstallService (int argc, char* argv[]) {
|
||||
CHAR path[MAX_PATH];
|
||||
|
||||
if (! GetModuleFileNameA(NULL, path, MAX_PATH)) {
|
||||
if (! GetModuleFileNameA(nullptr, path, MAX_PATH)) {
|
||||
std::cerr << "FATAL: GetModuleFileNameA failed" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -158,14 +158,14 @@ static void InstallService (int argc, char* argv[]) {
|
|||
static void DeleteService (int argc, char* argv[], bool force) {
|
||||
CHAR path[MAX_PATH] = "";
|
||||
|
||||
if (! GetModuleFileNameA(NULL, path, MAX_PATH)) {
|
||||
if (! GetModuleFileNameA(nullptr, path, MAX_PATH)) {
|
||||
std::cerr << "FATAL: GetModuleFileNameA failed" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::cout << "INFO: removing service '" << ServiceName << "'" << std::endl;
|
||||
|
||||
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
SC_HANDLE schSCManager = OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if (schSCManager == 0) {
|
||||
std::cerr << "FATAL: OpenSCManager failed with " << GetLastError() << std::endl;
|
||||
|
@ -233,7 +233,7 @@ static void StartArangoService (bool WaitForRunning) {
|
|||
SERVICE_STATUS_PROCESS ssp;
|
||||
DWORD bytesNeeded;
|
||||
|
||||
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
SC_HANDLE schSCManager = OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if (schSCManager == 0) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
|
@ -247,7 +247,7 @@ static void StartArangoService (bool WaitForRunning) {
|
|||
SERVICE_QUERY_STATUS |
|
||||
SERVICE_ENUMERATE_DEPENDENTS);
|
||||
|
||||
if (arangoService == NULL) {
|
||||
if (arangoService == nullptr) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
std::cerr << "INFO: OpenService failed with " << windowsErrorBuf << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -270,7 +270,7 @@ static void StartArangoService (bool WaitForRunning) {
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (! StartService(arangoService, 0, NULL) ) {
|
||||
if (! StartService(arangoService, 0, nullptr) ) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
std::cout << "StartService failed " << windowsErrorBuf << std::endl;
|
||||
CloseServiceHandle(arangoService);
|
||||
|
@ -312,7 +312,7 @@ static void StopArangoService (bool WaitForShutdown) {
|
|||
SERVICE_STATUS_PROCESS ssp;
|
||||
DWORD bytesNeeded;
|
||||
|
||||
SC_HANDLE schSCManager = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
SC_HANDLE schSCManager = OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if (schSCManager == 0) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
|
@ -327,7 +327,7 @@ static void StopArangoService (bool WaitForShutdown) {
|
|||
SERVICE_QUERY_STATUS |
|
||||
SERVICE_ENUMERATE_DEPENDENTS);
|
||||
|
||||
if (arangoService == NULL) {
|
||||
if (arangoService == nullptr) {
|
||||
TRI_SYSTEM_ERROR();
|
||||
std::cerr << "INFO: OpenService failed with " << windowsErrorBuf << std::endl;
|
||||
CloseServiceHandle(schSCManager);
|
||||
|
@ -513,13 +513,13 @@ LONG CALLBACK unhandledExceptionHandler (EXCEPTION_POINTERS *e) {
|
|||
MINIDUMP_TYPE(MiniDumpWithIndirectlyReferencedMemory |
|
||||
MiniDumpScanMemory |
|
||||
MiniDumpWithFullMemory),
|
||||
e ? &exceptionInfo : NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
e ? &exceptionInfo : nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
|
||||
if (hFile) {
|
||||
CloseHandle(hFile);
|
||||
hFile = NULL;
|
||||
hFile = nullptr;
|
||||
}
|
||||
#endif
|
||||
if ((e != nullptr) && (e->ExceptionRecord != nullptr)) {
|
||||
|
@ -705,7 +705,7 @@ void TRI_StartService (int argc, char* argv[]) {
|
|||
|
||||
SERVICE_TABLE_ENTRY ste[] = {
|
||||
{ TEXT(""), (LPSERVICE_MAIN_FUNCTION) ServiceMain },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
ARGC = argc;
|
||||
|
|
|
@ -779,7 +779,7 @@ void ApplicationV8::upgradeDatabase (bool skip,
|
|||
}
|
||||
|
||||
LOG_INFO("finished");
|
||||
TRI_EXIT_FUNCTION(EXIT_SUCCESS, NULL);
|
||||
TRI_EXIT_FUNCTION(EXIT_SUCCESS, nullptr);
|
||||
}
|
||||
else {
|
||||
// and return from the context
|
||||
|
@ -865,10 +865,10 @@ void ApplicationV8::versionCheck () {
|
|||
}
|
||||
|
||||
if (result == 1) {
|
||||
TRI_EXIT_FUNCTION(EXIT_SUCCESS, NULL);
|
||||
TRI_EXIT_FUNCTION(EXIT_SUCCESS, nullptr);
|
||||
}
|
||||
else {
|
||||
TRI_EXIT_FUNCTION(result, NULL);
|
||||
TRI_EXIT_FUNCTION(result, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
void TRI_InitMasterInfoReplication (TRI_replication_master_info_t* info,
|
||||
const char* endpoint) {
|
||||
TRI_ASSERT(endpoint != NULL);
|
||||
TRI_ASSERT(endpoint != nullptr);
|
||||
|
||||
info->_endpoint = TRI_DuplicateStringZ(TRI_CORE_MEM_ZONE, endpoint);
|
||||
info->_serverId = 0;
|
||||
|
@ -61,9 +61,9 @@ void TRI_InitMasterInfoReplication (TRI_replication_master_info_t* info,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_DestroyMasterInfoReplication (TRI_replication_master_info_t* info) {
|
||||
if (info->_endpoint != NULL) {
|
||||
if (info->_endpoint != nullptr) {
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, info->_endpoint);
|
||||
info->_endpoint = NULL;
|
||||
info->_endpoint = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ void TRI_DestroyMasterInfoReplication (TRI_replication_master_info_t* info) {
|
|||
|
||||
void TRI_LogMasterInfoReplication (TRI_replication_master_info_t const* info,
|
||||
const char* prefix) {
|
||||
TRI_ASSERT(info->_endpoint != NULL);
|
||||
TRI_ASSERT(info->_endpoint != nullptr);
|
||||
|
||||
LOG_INFO("%s master at %s, id %llu, version %d.%d, last log tick %llu",
|
||||
prefix,
|
||||
|
|
|
@ -2357,7 +2357,7 @@ int main (int argc, char* args[]) {
|
|||
bool promptError = false;
|
||||
#if _WIN32
|
||||
extern bool cygwinShell;
|
||||
if (getenv("SHELL") != NULL) {
|
||||
if (getenv("SHELL") != nullptr) {
|
||||
cygwinShell = true;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue