[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 03/06: fixed json array loop
From: |
gnunet |
Subject: |
[taler-anastasis] 03/06: fixed json array loop |
Date: |
Tue, 15 Sep 2020 19:28:19 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit eea60881b6ce87f42f05aa3bf0ebe6dd3e52eda3
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Tue Sep 15 15:27:33 2020 +0200
fixed json array loop
---
src/lib/anastasis_api_backup_redux.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/src/lib/anastasis_api_backup_redux.c
b/src/lib/anastasis_api_backup_redux.c
index 3aaa362..b41aa48 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -144,9 +144,9 @@ select_continent (const json_t *state,
json_t *new_state;
size_t index;
json_t *country;
- json_t *continent = json_object_get (arguments, "continent");
json_t *root = json_object_get (redux_countries, "countries");
json_t *countries = json_array ();
+ json_t *continent = json_object_get (arguments, "continent");
if (NULL == state)
{
@@ -173,21 +173,10 @@ select_continent (const json_t *state,
json_array_foreach (root, index, country)
{
- size_t inner_index;
- json_t *inner_country;
- json_t *temp_continent = json_object_get (json_array_get (root, index),
+ json_t *temp_continent = json_object_get (country,
"continent");
- bool existing = false;
- json_array_foreach (countries, inner_index, inner_country)
- {
- if (1 == json_equal (continent, temp_continent))
- {
- existing = true;
- break;
- }
- }
- if (! existing)
+ if (1 == json_equal (continent, temp_continent))
json_array_append_new (countries, country);
}
@@ -201,7 +190,7 @@ select_continent (const json_t *state,
// optional:
json_object_set_new (new_state,
"selected_continent",
- json_object_get (continent, "continent"));
+ continent);
cb (cb_cls,
ANASTASIS_EC_NONE,
new_state);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (aa001ce -> 5e3ee12), gnunet, 2020/09/15
- [taler-anastasis] 01/06: fix include, gnunet, 2020/09/15
- [taler-anastasis] 04/06: add select country, gnunet, 2020/09/15
- [taler-anastasis] 02/06: worked on select country, gnunet, 2020/09/15
- [taler-anastasis] 03/06: fixed json array loop,
gnunet <=
- [taler-anastasis] 06/06: Merge branch 'master' of ssh://git.taler.net/anastasis into master, gnunet, 2020/09/15
- [taler-anastasis] 05/06: fix country selection, gnunet, 2020/09/15