summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/libjson/src/JSONNode.cpp40
-rw-r--r--libs/libjson/src/JSONNode.h4
-rw-r--r--libs/libjson/src/libJSON.cpp4
-rw-r--r--libs/libjson/src/libjson.def4
-rw-r--r--libs/libjson/src/libjson64.def4
5 files changed, 17 insertions, 39 deletions
diff --git a/libs/libjson/src/JSONNode.cpp b/libs/libjson/src/JSONNode.cpp
index 37e5d4ffe0..9bdc70e7e6 100644
--- a/libs/libjson/src/JSONNode.cpp
+++ b/libs/libjson/src/JSONNode.cpp
@@ -255,46 +255,24 @@ const JSONNode & JSONNode::at(const json_char *name_t) const {
}
#endif
-#ifndef JSON_LIBRARY
- struct auto_delete {
- public:
- auto_delete(JSONNode *node) : mynode(node){};
- ~auto_delete(void){ JSONNode::deleteJSONNode(mynode); };
- JSONNode * mynode;
- private:
- auto_delete(const auto_delete &);
- auto_delete & operator = (const auto_delete &);
- };
-#endif
-
-JSONNode JSON_PTR_LIB JSONNode::pop_back(json_index_t pos){
+JSONNode* JSON_PTR_LIB JSONNode::pop_back(json_index_t pos){
JSON_CHECK_INTERNAL();
if (pos >= internal -> size()) {
JSON_FAIL(JSON_TEXT("pop_back out of bounds"));
- return nullNode;
+ return &nullNode;
}
makeUniqueInternal();
- #ifdef JSON_LIBRARY
- return internal -> pop_back(pos);
- #else
- auto_delete temp(internal -> pop_back(pos));
- return *temp.mynode;
- #endif
+ return internal -> pop_back(pos);
}
-JSONNode JSON_PTR_LIB JSONNode::pop_back(const json_string & name_t){
+JSONNode* JSON_PTR_LIB JSONNode::pop_back(const json_string & name_t){
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("popping a non-iteratable node"));
- #ifdef JSON_LIBRARY
- return internal -> pop_back(name_t);
- #else
- if (JSONNode * res = internal -> pop_back(name_t)) {
- auto_delete temp(res);
- return *(temp.mynode);
- }
- JSON_FAIL(json_string(JSON_TEXT("pop_back const could not find child by name: ")) + name_t);
- return nullNode;
- #endif
+ if (JSONNode *res = internal -> pop_back(name_t))
+ return res;
+
+ JSON_FAIL(json_string(JSON_TEXT("pop_back const could not find child by name: ")) + name_t);
+ return &nullNode;
}
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
diff --git a/libs/libjson/src/JSONNode.h b/libs/libjson/src/JSONNode.h
index fe32427019..2f5119ef90 100644
--- a/libs/libjson/src/JSONNode.h
+++ b/libs/libjson/src/JSONNode.h
@@ -152,8 +152,8 @@ public:
#endif
JSONNode& operator<<(const JSONNode & node);
void reserve(json_index_t size);
- JSONNode JSON_PTR_LIB pop_back(json_index_t pos);
- JSONNode JSON_PTR_LIB pop_back(const json_string & name_t);
+ JSONNode* JSON_PTR_LIB pop_back(json_index_t pos);
+ JSONNode* JSON_PTR_LIB pop_back(const json_string & name_t);
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
JSONNode JSON_PTR_LIB pop_back_nocase(const json_string & name_t);
#endif
diff --git a/libs/libjson/src/libJSON.cpp b/libs/libjson/src/libJSON.cpp
index dbd57b2c26..255e3b1d06 100644
--- a/libs/libjson/src/libJSON.cpp
+++ b/libs/libjson/src/libJSON.cpp
@@ -440,13 +440,13 @@ LIBJSON_DLL(void) json_push_back(JSONNode *node, JSONNode *node2) {
LIBJSON_DLL(JSONNode*) json_pop_back_at(JSONNode *node, json_index_t pos) {
JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back_i"), return 0;);
- return MANAGER_INSERT(&node->pop_back(pos));
+ return MANAGER_INSERT(node->pop_back(pos));
}
LIBJSON_DLL(JSONNode*) json_pop_back(JSONNode *node, const json_char *name) {
JSON_ASSERT_SAFE(node, JSON_TEXT("null node to json_pop_back"), return 0;);
JSON_ASSERT_SAFE(name, JSON_TEXT("null name to json_pop_back. Did you mean to use json_pop_back_at?"), return 0;);
- return MANAGER_INSERT(&node->pop_back(name));
+ return MANAGER_INSERT(node->pop_back(name));
}
//comparison
diff --git a/libs/libjson/src/libjson.def b/libs/libjson/src/libjson.def
index 204713341f..987daf7e78 100644
--- a/libs/libjson/src/libjson.def
+++ b/libs/libjson/src/libjson.def
@@ -134,8 +134,8 @@ EXPORTS
?nullify@JSONNode@@QAEXXZ @131 NONAME
?parse@JSONNode@@SA?AV1@PBD@Z @132 NONAME
?parse@JSONWorker@@SA?AVJSONNode@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z @133 NONAME
-?pop_back@JSONNode@@QAE?AV1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z @134 NONAME
-?pop_back@JSONNode@@QAE?AV1@I@Z @135 NONAME
+?pop_back@JSONNode@@QAEPAV1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z @134 NONAME
+?pop_back@JSONNode@@QAEPAV1@I@Z @135 NONAME
?preparse@JSONNode@@QAEXXZ @136 NONAME
?push_back@JSONNode@@QAEXABV1@@Z @137 NONAME
?rbegin@JSONNode@@QAE?AUreverse_iterator@1@XZ @138 NONAME
diff --git a/libs/libjson/src/libjson64.def b/libs/libjson/src/libjson64.def
index fa9a40d79d..4f19d6e994 100644
--- a/libs/libjson/src/libjson64.def
+++ b/libs/libjson/src/libjson64.def
@@ -134,8 +134,8 @@ EXPORTS
?nullify@JSONNode@@QEAAXXZ @131 NONAME
?parse@JSONNode@@SA?AV1@PEBD@Z @132 NONAME
?parse@JSONWorker@@SA?AVJSONNode@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z @133 NONAME
-?pop_back@JSONNode@@QEAA?AV1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z @134 NONAME
-?pop_back@JSONNode@@QEAA?AV1@_K@Z @135 NONAME
+?pop_back@JSONNode@@QEAAPEAV1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z @134 NONAME
+?pop_back@JSONNode@@QEAAPEAV1@_K@Z @135 NONAME
?preparse@JSONNode@@QEAAXXZ @136 NONAME
?push_back@JSONNode@@QEAAXAEBV1@@Z @137 NONAME
?rbegin@JSONNode@@QEAA?AUreverse_iterator@1@XZ @138 NONAME