Commit Diff


commit - 17410fed5985559b38f8be4ffe7a550af2cd9b96
commit + d5faed8f62550914f4e06a8b1464702aa39d1c0b
blob - 09dda969a1603ce0214a117f11d6df008a4f9adb
blob + 5a40ba7e79d21c2038ec1aad6b877d1b89ed1dec
--- fight.c
+++ fight.c
@@ -409,7 +409,7 @@ save_fight()
 {
 	struct character *curchar = get_current_character();
 	char path[_POSIX_PATH_MAX];
-	json_object *root, *items;
+	json_object *root, *items, *id;
 	int temp_n, i;
 
 	if (curchar == NULL) {
@@ -449,7 +449,7 @@ save_fight()
 		temp_n = json_object_array_length(items);
 		for (i = 0; i < temp_n; i++) {
 			json_object *temp = json_object_array_get_idx(items, i);
-			json_object *id = json_object_object_get(temp, "id");
+			json_object_object_get_ex(temp, "id", &id);
 			if (curchar->id == json_object_get_int(id)) {
 				log_debug("Update fight entry for %s\n", curchar->name);
 				json_object_array_del_idx(items, i, 1);
@@ -474,7 +474,7 @@ void
 delete_fight(int id)
 {
 	char path[_POSIX_PATH_MAX];
-	json_object *root;
+	json_object *root, *lid;
 	int temp_n, i;
 
 	snprintf(path, sizeof(path), "%s/fight.json", get_isscrolls_dir());
@@ -492,7 +492,7 @@ delete_fight(int id)
 	temp_n = json_object_array_length(fight);
 	for (i = 0; i < temp_n; i++) {
 		json_object *temp = json_object_array_get_idx(fight, i);
-		json_object *lid = json_object_object_get(temp, "id");
+		json_object_object_get_ex(temp, "id", &lid);
 		if (id == json_object_get_int(lid)) {
 			json_object_array_del_idx(fight, i, 1);
 			log_debug("Deleted fight entry for %d\n", id);
@@ -512,7 +512,7 @@ load_fight(int id)
 {
 	struct character *curchar = get_current_character();
 	char path[_POSIX_PATH_MAX];
-	json_object *root;
+	json_object *root, *lid;
 	int temp_n, i;
 
 	if (curchar == NULL) {
@@ -535,7 +535,7 @@ load_fight(int id)
 	temp_n = json_object_array_length(fight);
 	for (i=0; i < temp_n; i++) {
 		json_object *temp = json_object_array_get_idx(fight, i);
-		json_object *lid = json_object_object_get(temp, "id");
+		json_object_object_get_ex(temp, "id", &lid);
 		if (id == json_object_get_int(lid)) {
 			log_debug("Loading fight for id: %d\n", json_object_get_int(lid));
 
blob - 76783c44f134361d41992aae4af524c005fe5c3d
blob + 5a7c3a3c9eccbf5a3aeb3788dd611dbd8577a2ed
--- journey.c
+++ journey.c
@@ -191,7 +191,7 @@ save_journey()
 {
 	struct character *curchar = get_current_character();
 	char path[_POSIX_PATH_MAX];
-	json_object *root, *items;
+	json_object *root, *items, *id;
 	int temp_n, i;
 
 	if (curchar == NULL) {
@@ -230,7 +230,7 @@ save_journey()
 		temp_n = json_object_array_length(items);
 		for (i = 0; i < temp_n; i++) {
 			json_object *temp = json_object_array_get_idx(items, i);
-			json_object *id = json_object_object_get(temp, "id");
+			json_object_object_get_ex(temp, "id", &id);
 			if (curchar->id == json_object_get_int(id)) {
 				log_debug("Update journey entry for %s\n", curchar->name);
 				json_object_array_del_idx(items, i, 1);
@@ -255,7 +255,7 @@ void
 delete_journey(int id)
 {
 	char path[_POSIX_PATH_MAX];
-	json_object *root;
+	json_object *root, *lid;
 	int temp_n, i;
 
 	snprintf(path, sizeof(path), "%s/journey.json", get_isscrolls_dir());
@@ -273,7 +273,7 @@ delete_journey(int id)
 	temp_n = json_object_array_length(journey);
 	for (i = 0; i < temp_n; i++) {
 		json_object *temp = json_object_array_get_idx(journey, i);
-		json_object *lid = json_object_object_get(temp, "id");
+		json_object_object_get_ex(temp, "id", &lid);
 		if (id == json_object_get_int(lid)) {
 			json_object_array_del_idx(journey, i, 1);
 			log_debug("Deleted journey entry for %d\n", id);
@@ -293,7 +293,7 @@ load_journey(int id)
 {
 	struct character *curchar = get_current_character();
 	char path[_POSIX_PATH_MAX];
-	json_object *root;
+	json_object *root, *lid;
 	int temp_n, i;
 
 	if (curchar == NULL) {
@@ -316,7 +316,7 @@ load_journey(int id)
 	temp_n = json_object_array_length(journey);
 	for (i=0; i < temp_n; i++) {
 		json_object *temp = json_object_array_get_idx(journey, i);
-		json_object *lid = json_object_object_get(temp, "id");
+		json_object_object_get_ex(temp, "id", &lid);
 		if (id == json_object_get_int(lid)) {
 			log_debug("Loading journey for id: %d\n", json_object_get_int(lid));