diff options
author | Omar Tarabai <tarabai@devegypt.com> | 2014-08-04 11:06:52 +0000 |
---|---|---|
committer | Omar Tarabai <tarabai@devegypt.com> | 2014-08-04 11:06:52 +0000 |
commit | 4371b0fcd9b50f78ca27ac48adf2f4663b2dfc9b (patch) | |
tree | 05c40696267088fa94cdb0a94b3c079b38ea8ed2 /src/peerstore/test_peerstore_api_sync.c | |
parent | ef494e57d189e2b7c038104e44398d11026ff6a6 (diff) | |
download | gnunet-4371b0fcd9b50f78ca27ac48adf2f4663b2dfc9b.tar.gz gnunet-4371b0fcd9b50f78ca27ac48adf2f4663b2dfc9b.zip |
peerstore: indentation
Diffstat (limited to 'src/peerstore/test_peerstore_api_sync.c')
-rw-r--r-- | src/peerstore/test_peerstore_api_sync.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c index 634f62c26..3803d72c1 100644 --- a/src/peerstore/test_peerstore_api_sync.c +++ b/src/peerstore/test_peerstore_api_sync.c | |||
@@ -37,7 +37,8 @@ static struct GNUNET_PeerIdentity pid; | |||
37 | static char *key = "test_peerstore_api_store_key"; | 37 | static char *key = "test_peerstore_api_store_key"; |
38 | static char *val = "test_peerstore_api_store_val"; | 38 | static char *val = "test_peerstore_api_store_val"; |
39 | 39 | ||
40 | int iterate_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | 40 | int |
41 | iterate_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | ||
41 | { | 42 | { |
42 | const char *rec_val; | 43 | const char *rec_val; |
43 | 44 | ||
@@ -45,46 +46,47 @@ int iterate_cb (void *cls, struct GNUNET_PEERSTORE_Record *record, char *emsg) | |||
45 | if (NULL == record) | 46 | if (NULL == record) |
46 | { | 47 | { |
47 | GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); | 48 | GNUNET_PEERSTORE_disconnect (h, GNUNET_NO); |
48 | GNUNET_SCHEDULER_shutdown(); | 49 | GNUNET_SCHEDULER_shutdown (); |
49 | return GNUNET_YES; | 50 | return GNUNET_YES; |
50 | } | 51 | } |
51 | rec_val = record->value; | 52 | rec_val = record->value; |
52 | GNUNET_break (0 == strcmp(rec_val, val)); | 53 | GNUNET_break (0 == strcmp (rec_val, val)); |
53 | ok = 0; | 54 | ok = 0; |
54 | return GNUNET_YES; | 55 | return GNUNET_YES; |
55 | } | 56 | } |
56 | 57 | ||
58 | |||
57 | static void | 59 | static void |
58 | test1() | 60 | test1 () |
59 | { | 61 | { |
60 | GNUNET_PEERSTORE_store (h, subsystem, &pid, key, val, strlen(val) + 1, | 62 | GNUNET_PEERSTORE_store (h, subsystem, &pid, key, val, strlen (val) + 1, |
61 | GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 63 | GNUNET_TIME_UNIT_FOREVER_ABS, |
62 | NULL, NULL); | 64 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, NULL, NULL); |
63 | GNUNET_PEERSTORE_disconnect (h, GNUNET_YES); | 65 | GNUNET_PEERSTORE_disconnect (h, GNUNET_YES); |
64 | h = GNUNET_PEERSTORE_connect (cfg); | 66 | h = GNUNET_PEERSTORE_connect (cfg); |
65 | GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, | 67 | GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, |
66 | GNUNET_TIME_UNIT_FOREVER_REL, &iterate_cb, NULL); | 68 | GNUNET_TIME_UNIT_FOREVER_REL, &iterate_cb, NULL); |
67 | } | 69 | } |
68 | 70 | ||
71 | |||
69 | static void | 72 | static void |
70 | run (void *cls, | 73 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, |
71 | const struct GNUNET_CONFIGURATION_Handle *c, | 74 | struct GNUNET_TESTING_Peer *peer) |
72 | struct GNUNET_TESTING_Peer *peer) | ||
73 | { | 75 | { |
74 | cfg = c; | 76 | cfg = c; |
75 | h = GNUNET_PEERSTORE_connect(cfg); | 77 | h = GNUNET_PEERSTORE_connect (cfg); |
76 | GNUNET_assert(NULL != h); | 78 | GNUNET_assert (NULL != h); |
77 | memset (&pid, 1, sizeof (pid)); | 79 | memset (&pid, 1, sizeof (pid)); |
78 | test1(); | 80 | test1 (); |
79 | } | 81 | } |
80 | 82 | ||
83 | |||
81 | int | 84 | int |
82 | main (int argc, char *argv[]) | 85 | main (int argc, char *argv[]) |
83 | { | 86 | { |
84 | if (0 != GNUNET_TESTING_service_run ("test-gnunet-peerstore", | 87 | if (0 != |
85 | "peerstore", | 88 | GNUNET_TESTING_service_run ("test-gnunet-peerstore", "peerstore", |
86 | "test_peerstore_api_data.conf", | 89 | "test_peerstore_api_data.conf", &run, NULL)) |
87 | &run, NULL)) | ||
88 | return 1; | 90 | return 1; |
89 | return ok; | 91 | return ok; |
90 | } | 92 | } |