aboutsummaryrefslogtreecommitdiff
path: root/dbfp_check.c
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2016-03-10 17:42:09 +0100
committerRobin Krahl <me@robin-krahl.de>2016-03-10 17:42:09 +0100
commit4c68c15d4d3102b26b824b0021901d1dd9d79e77 (patch)
tree47688168607b1c25002ab45eeb197a3bfaa21567 /dbfp_check.c
parentde9f0aa8f8d248292815e5571e1fa3fb068de8c3 (diff)
downloaddbfp-4c68c15d4d3102b26b824b0021901d1dd9d79e77.tar.gz
dbfp-4c68c15d4d3102b26b824b0021901d1dd9d79e77.tar.bz2
dbfp: move curl handle to dbfp
As the curl handle can be reused between requests, it is moved to the dbfp structure, initialized in dbfp_init and freed in dbfp_close.
Diffstat (limited to 'dbfp_check.c')
-rw-r--r--dbfp_check.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/dbfp_check.c b/dbfp_check.c
index 5e8e225..a9da26c 100644
--- a/dbfp_check.c
+++ b/dbfp_check.c
@@ -69,6 +69,26 @@ START_TEST(test_dbfp_location_simple)
free(locations[i].id);
}
free(locations);
+ locations = NULL;
+
+ err = dbfp_query_location_name(&dbfp, "freib", &n, &locations);
+ ck_assert_int_eq(err, 0);
+
+ ck_assert_int_gt(n, 0);
+ ck_assert_ptr_ne(locations, NULL);
+
+ ck_assert_str_eq(locations[0].name, "Freiburg(Breisgau) Hbf");
+ ck_assert_str_eq(locations[0].id, "008000107");
+ ck_assert(locations[0].lon == 7.841173f);
+ ck_assert(locations[0].lat == 47.997696f);
+
+ for (i = 0; i < n; i++) {
+ free(locations[i].name);
+ free(locations[i].id);
+ }
+ free(locations);
+ locations = NULL;
+
dbfp_close(&dbfp);
}
END_TEST