summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/mozjs/timestamp.cpp
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2015-10-06 20:08:03 -0400
committerJason Carey <jcarey@argv.me>2015-10-06 20:14:01 -0400
commit95060c27ed2dddcb6343a88f7aa405ed8a935ad7 (patch)
treeea6d2287cbdb7154d22af6335ae1f56ac7b6aba0 /src/mongo/scripting/mozjs/timestamp.cpp
parentb7104c6f2f597335c6b9890ff6b80243625a6258 (diff)
downloadmongo-95060c27ed2dddcb6343a88f7aa405ed8a935ad7.tar.gz
SERVER-19977 Intern JS Strings
Rather than supplying const char*'s throughout our use of the MozJS api, intern the strings and root their associated ids (to save on string parsing).
Diffstat (limited to 'src/mongo/scripting/mozjs/timestamp.cpp')
-rw-r--r--src/mongo/scripting/mozjs/timestamp.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/scripting/mozjs/timestamp.cpp b/src/mongo/scripting/mozjs/timestamp.cpp
index 8659d8a4d85..198ee3af5b2 100644
--- a/src/mongo/scripting/mozjs/timestamp.cpp
+++ b/src/mongo/scripting/mozjs/timestamp.cpp
@@ -31,6 +31,7 @@
#include "mongo/scripting/mozjs/timestamp.h"
#include "mongo/scripting/mozjs/implscope.h"
+#include "mongo/scripting/mozjs/internedstring.h"
#include "mongo/scripting/mozjs/objectwrapper.h"
#include "mongo/scripting/mozjs/valuereader.h"
#include "mongo/scripting/mozjs/valuewriter.h"
@@ -49,8 +50,8 @@ void TimestampInfo::construct(JSContext* cx, JS::CallArgs args) {
ObjectWrapper o(cx, thisv);
if (args.length() == 0) {
- o.setNumber("t", 0);
- o.setNumber("i", 0);
+ o.setNumber(InternedString::t, 0);
+ o.setNumber(InternedString::i, 0);
} else if (args.length() == 2) {
if (!args.get(0).isNumber())
uasserted(ErrorCodes::BadValue, "Timestamp time must be a number");
@@ -64,8 +65,8 @@ void TimestampInfo::construct(JSContext* cx, JS::CallArgs args) {
str::stream() << "The first argument must be in seconds; " << t
<< " is too large (max " << largestVal << ")");
- o.setValue("t", args.get(0));
- o.setValue("i", args.get(1));
+ o.setValue(InternedString::t, args.get(0));
+ o.setValue(InternedString::i, args.get(1));
} else {
uasserted(ErrorCodes::BadValue, "Timestamp needs 0 or 2 arguments");
}