summaryrefslogtreecommitdiff
path: root/src/mongo/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r--src/mongo/scripting/mozjs/jscustomallocator.cpp4
-rw-r--r--src/mongo/scripting/mozjs/mongo.cpp18
-rw-r--r--src/mongo/scripting/mozjs/mongo.h5
3 files changed, 6 insertions, 21 deletions
diff --git a/src/mongo/scripting/mozjs/jscustomallocator.cpp b/src/mongo/scripting/mozjs/jscustomallocator.cpp
index 28afb60fa88..f8031f54ad2 100644
--- a/src/mongo/scripting/mozjs/jscustomallocator.cpp
+++ b/src/mongo/scripting/mozjs/jscustomallocator.cpp
@@ -43,8 +43,6 @@
#include <malloc/malloc.h>
#elif defined(_WIN32)
#include <malloc.h>
-#elif defined(__FreeBSD__)
-#include <malloc_np.h>
#else
#define MONGO_NO_MALLOC_USABLE_SIZE
#endif
@@ -185,7 +183,7 @@ size_t get_current(void* ptr) {
return 0;
return *reinterpret_cast<size_t*>(static_cast<char*>(ptr) - kMaxAlign);
-#elif defined(__linux__) || defined(__FreeBSD__)
+#elif defined(__linux__)
return malloc_usable_size(ptr);
#elif defined(__APPLE__)
return malloc_size(ptr);
diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp
index 3e2a1e9b05a..00818afb115 100644
--- a/src/mongo/scripting/mozjs/mongo.cpp
+++ b/src/mongo/scripting/mozjs/mongo.cpp
@@ -86,7 +86,6 @@ const JSFunctionSpec MongoBase::methods[] = {
const char* const MongoBase::className = "Mongo";
EncryptedDBClientCallback* encryptedDBClientCallback = nullptr;
-GetNestedConnectionCallback* getNestedConnectionCallback = nullptr;
const JSFunctionSpec MongoExternalInfo::freeFunctions[4] = {
MONGO_ATTACH_JS_FUNCTION(_forgetReplSet),
@@ -488,16 +487,9 @@ void MongoBase::Functions::_markNodeAsFailed::call(JSContext* cx, JS::CallArgs a
"third argument to _markNodeAsFailed must be a stringified reason");
}
- DBClientReplicaSet* rsConn = dynamic_cast<DBClientReplicaSet*>(getConnection(args));
- if (!rsConn && getNestedConnectionCallback) {
- DBClientBase* base = getNestedConnectionCallback(getConnection(args));
- if (base) {
- rsConn = dynamic_cast<DBClientReplicaSet*>(base);
- }
- }
-
+ auto* rsConn = dynamic_cast<DBClientReplicaSet*>(getConnection(args));
if (!rsConn) {
- uasserted(ErrorCodes::BadValue, "connection object is not a replica set object");
+ uasserted(ErrorCodes::BadValue, "connection object isn't a replica set connection");
}
auto hostAndPort = ValueWriter(cx, args.get(0)).toString();
@@ -522,10 +514,8 @@ std::unique_ptr<DBClientBase> runEncryptedDBClientCallback(std::unique_ptr<DBCli
return conn;
}
-void setEncryptedDBClientCallbacks(EncryptedDBClientCallback* encCallback,
- GetNestedConnectionCallback* getCallback) {
- encryptedDBClientCallback = encCallback;
- getNestedConnectionCallback = getCallback;
+void setEncryptedDBClientCallback(EncryptedDBClientCallback* callback) {
+ encryptedDBClientCallback = callback;
}
// "new Mongo(uri, encryptedDBClientCallback, {options...})"
diff --git a/src/mongo/scripting/mozjs/mongo.h b/src/mongo/scripting/mozjs/mongo.h
index afd0db9faf6..b79ba3f061a 100644
--- a/src/mongo/scripting/mozjs/mongo.h
+++ b/src/mongo/scripting/mozjs/mongo.h
@@ -39,10 +39,7 @@ using EncryptedDBClientCallback = std::unique_ptr<DBClientBase>(std::unique_ptr<
JS::HandleValue,
JS::HandleObject,
JSContext*);
-
-using GetNestedConnectionCallback = DBClientBase*(DBClientBase*);
-void setEncryptedDBClientCallbacks(EncryptedDBClientCallback* encCallback,
- GetNestedConnectionCallback* getCallback);
+void setEncryptedDBClientCallback(EncryptedDBClientCallback* callback);
/**
* Shared code for the "Mongo" javascript object.