aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_gnsrecord_reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-14 00:09:18 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-14 10:01:24 +0200
commiteb2d072aa1096c9d77cbfde239a1004cab642e64 (patch)
treeb44e82f972c503a64a6f2679edd340f7a1ecdda6 /src/reclaim/plugin_gnsrecord_reclaim.c
parentaf90492d9f86b3bcce93a8459383744939318bc3 (diff)
downloadgnunet-eb2d072aa1096c9d77cbfde239a1004cab642e64.tar.gz
gnunet-eb2d072aa1096c9d77cbfde239a1004cab642e64.zip
RECLAIM: Simplify logic
Diffstat (limited to 'src/reclaim/plugin_gnsrecord_reclaim.c')
-rw-r--r--src/reclaim/plugin_gnsrecord_reclaim.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c b/src/reclaim/plugin_gnsrecord_reclaim.c
index 612fec3bd..48cdd9811 100644
--- a/src/reclaim/plugin_gnsrecord_reclaim.c
+++ b/src/reclaim/plugin_gnsrecord_reclaim.c
@@ -39,8 +39,8 @@
39 * @param data_size number of bytes in @a data 39 * @param data_size number of bytes in @a data
40 * @return NULL on error, otherwise human-readable representation of the value 40 * @return NULL on error, otherwise human-readable representation of the value
41 */ 41 */
42static char *value_to_string (void *cls, uint32_t type, const void *data, 42static char *
43 size_t data_size) 43value_to_string (void *cls, uint32_t type, const void *data, size_t data_size)
44{ 44{
45 switch (type) { 45 switch (type) {
46 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR: 46 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
@@ -49,7 +49,7 @@ static char *value_to_string (void *cls, uint32_t type, const void *data,
49 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 49 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
50 return GNUNET_strndup (data, data_size); 50 return GNUNET_strndup (data, data_size);
51 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: 51 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF:
52 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKETREF: 52 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
53 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: 53 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
54 return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 54 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
55 default: 55 default:
@@ -69,8 +69,9 @@ static char *value_to_string (void *cls, uint32_t type, const void *data,
69 * @param data_size set to number of bytes in @a data 69 * @param data_size set to number of bytes in @a data
70 * @return #GNUNET_OK on success 70 * @return #GNUNET_OK on success
71 */ 71 */
72static int string_to_value (void *cls, uint32_t type, const char *s, 72static int
73 void **data, size_t *data_size) 73string_to_value (void *cls, uint32_t type, const char *s, void **data,
74 size_t *data_size)
74{ 75{
75 if (NULL == s) 76 if (NULL == s)
76 return GNUNET_SYSERR; 77 return GNUNET_SYSERR;
@@ -84,7 +85,7 @@ static int string_to_value (void *cls, uint32_t type, const char *s,
84 return GNUNET_OK; 85 return GNUNET_OK;
85 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: 86 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF:
86 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: 87 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
87 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKETREF: 88 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
88 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size); 89 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
89 default: 90 default:
90 return GNUNET_SYSERR; 91 return GNUNET_SYSERR;
@@ -105,7 +106,7 @@ static struct {
105 {"RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER}, 106 {"RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER},
106 {"RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT}, 107 {"RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT},
107 {"RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT}, 108 {"RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT},
108 {"RECLAIM_TICKETREF", GNUNET_GNSRECORD_TYPE_RECLAIM_TICKETREF}, 109 {"RECLAIM_TICKET", GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET},
109 {NULL, UINT32_MAX}}; 110 {NULL, UINT32_MAX}};
110 111
111 112
@@ -116,7 +117,8 @@ static struct {
116 * @param dns_typename name to convert 117 * @param dns_typename name to convert
117 * @return corresponding number, UINT32_MAX on error 118 * @return corresponding number, UINT32_MAX on error
118 */ 119 */
119static uint32_t typename_to_number (void *cls, const char *dns_typename) 120static uint32_t
121typename_to_number (void *cls, const char *dns_typename)
120{ 122{
121 unsigned int i; 123 unsigned int i;
122 124
@@ -135,7 +137,8 @@ static uint32_t typename_to_number (void *cls, const char *dns_typename)
135 * @param type number of a type to convert 137 * @param type number of a type to convert
136 * @return corresponding typestring, NULL on error 138 * @return corresponding typestring, NULL on error
137 */ 139 */
138static const char *number_to_typename (void *cls, uint32_t type) 140static const char *
141number_to_typename (void *cls, uint32_t type)
139{ 142{
140 unsigned int i; 143 unsigned int i;
141 144
@@ -152,7 +155,8 @@ static const char *number_to_typename (void *cls, uint32_t type)
152 * @param cls NULL 155 * @param cls NULL
153 * @return the exported block API 156 * @return the exported block API
154 */ 157 */
155void *libgnunet_plugin_gnsrecord_reclaim_init (void *cls) 158void *
159libgnunet_plugin_gnsrecord_reclaim_init (void *cls)
156{ 160{
157 struct GNUNET_GNSRECORD_PluginFunctions *api; 161 struct GNUNET_GNSRECORD_PluginFunctions *api;
158 162
@@ -171,7 +175,8 @@ void *libgnunet_plugin_gnsrecord_reclaim_init (void *cls)
171 * @param cls the return value from #libgnunet_plugin_block_test_init 175 * @param cls the return value from #libgnunet_plugin_block_test_init
172 * @return NULL 176 * @return NULL
173 */ 177 */
174void *libgnunet_plugin_gnsrecord_reclaim_done (void *cls) 178void *
179libgnunet_plugin_gnsrecord_reclaim_done (void *cls)
175{ 180{
176 struct GNUNET_GNSRECORD_PluginFunctions *api = cls; 181 struct GNUNET_GNSRECORD_PluginFunctions *api = cls;
177 182