aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_list_indexed.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
commitc4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch)
treecac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/fs/fs_list_indexed.c
parentfbb71d527c7d6babf269a8fefce1db291b9f7068 (diff)
downloadgnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz
gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/fs/fs_list_indexed.c')
-rw-r--r--src/fs/fs_list_indexed.c129
1 files changed, 65 insertions, 64 deletions
diff --git a/src/fs/fs_list_indexed.c b/src/fs/fs_list_indexed.c
index c023d0ac6..0e16fb01b 100644
--- a/src/fs/fs_list_indexed.c
+++ b/src/fs/fs_list_indexed.c
@@ -34,7 +34,8 @@
34/** 34/**
35 * Context for #GNUNET_FS_get_indexed_files(). 35 * Context for #GNUNET_FS_get_indexed_files().
36 */ 36 */
37struct GNUNET_FS_GetIndexedContext { 37struct GNUNET_FS_GetIndexedContext
38{
38 /** 39 /**
39 * Connection to the FS service. 40 * Connection to the FS service.
40 */ 41 */
@@ -70,15 +71,15 @@ struct GNUNET_FS_GetIndexedContext {
70 * @param msg message with indexing information 71 * @param msg message with indexing information
71 */ 72 */
72static void 73static void
73handle_index_info_end(void *cls, 74handle_index_info_end (void *cls,
74 const struct GNUNET_MessageHeader *msg) 75 const struct GNUNET_MessageHeader *msg)
75{ 76{
76 struct GNUNET_FS_GetIndexedContext *gic = cls; 77 struct GNUNET_FS_GetIndexedContext *gic = cls;
77 78
78 (void)gic->iterator(gic->iterator_cls, 79 (void) gic->iterator (gic->iterator_cls,
79 NULL, 80 NULL,
80 NULL); 81 NULL);
81 GNUNET_FS_get_indexed_files_cancel(gic); 82 GNUNET_FS_get_indexed_files_cancel (gic);
82} 83}
83 84
84 85
@@ -90,18 +91,18 @@ handle_index_info_end(void *cls,
90 * @param iim message with indexing information 91 * @param iim message with indexing information
91 */ 92 */
92static int 93static int
93check_index_info(void *cls, 94check_index_info (void *cls,
94 const struct IndexInfoMessage *iim) 95 const struct IndexInfoMessage *iim)
95{ 96{
96 uint16_t msize = ntohs(iim->header.size) - sizeof(*iim); 97 uint16_t msize = ntohs (iim->header.size) - sizeof(*iim);
97 const char *filename; 98 const char *filename;
98 99
99 filename = (const char *)&iim[1]; 100 filename = (const char *) &iim[1];
100 if (filename[msize - 1] != '\0') 101 if (filename[msize - 1] != '\0')
101 { 102 {
102 GNUNET_break(0); 103 GNUNET_break (0);
103 return GNUNET_SYSERR; 104 return GNUNET_SYSERR;
104 } 105 }
105 return GNUNET_OK; 106 return GNUNET_OK;
106} 107}
107 108
@@ -114,21 +115,21 @@ check_index_info(void *cls,
114 * @param iim message with indexing information 115 * @param iim message with indexing information
115 */ 116 */
116static void 117static void
117handle_index_info(void *cls, 118handle_index_info (void *cls,
118 const struct IndexInfoMessage *iim) 119 const struct IndexInfoMessage *iim)
119{ 120{
120 struct GNUNET_FS_GetIndexedContext *gic = cls; 121 struct GNUNET_FS_GetIndexedContext *gic = cls;
121 const char *filename; 122 const char *filename;
122 123
123 filename = (const char *)&iim[1]; 124 filename = (const char *) &iim[1];
124 if (GNUNET_OK != 125 if (GNUNET_OK !=
125 gic->iterator(gic->iterator_cls, 126 gic->iterator (gic->iterator_cls,
126 filename, 127 filename,
127 &iim->file_id)) 128 &iim->file_id))
128 { 129 {
129 GNUNET_FS_get_indexed_files_cancel(gic); 130 GNUNET_FS_get_indexed_files_cancel (gic);
130 return; 131 return;
131 } 132 }
132} 133}
133 134
134 135
@@ -141,16 +142,16 @@ handle_index_info(void *cls,
141 * @param error error code 142 * @param error error code
142 */ 143 */
143static void 144static void
144mq_error_handler(void *cls, 145mq_error_handler (void *cls,
145 enum GNUNET_MQ_Error error) 146 enum GNUNET_MQ_Error error)
146{ 147{
147 struct GNUNET_FS_GetIndexedContext *gic = cls; 148 struct GNUNET_FS_GetIndexedContext *gic = cls;
148 149
149 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 150 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
150 _("Failed to receive response from `%s' service.\n"), 151 _ ("Failed to receive response from `%s' service.\n"),
151 "fs"); 152 "fs");
152 (void)gic->iterator(gic->iterator_cls, NULL, NULL); 153 (void) gic->iterator (gic->iterator_cls, NULL, NULL);
153 GNUNET_FS_get_indexed_files_cancel(gic); 154 GNUNET_FS_get_indexed_files_cancel (gic);
154} 155}
155 156
156 157
@@ -163,45 +164,45 @@ mq_error_handler(void *cls,
163 * @return NULL on error ('iter' is not called) 164 * @return NULL on error ('iter' is not called)
164 */ 165 */
165struct GNUNET_FS_GetIndexedContext * 166struct GNUNET_FS_GetIndexedContext *
166GNUNET_FS_get_indexed_files(struct GNUNET_FS_Handle *h, 167GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h,
167 GNUNET_FS_IndexedFileProcessor iterator, 168 GNUNET_FS_IndexedFileProcessor iterator,
168 void *iterator_cls) 169 void *iterator_cls)
169{ 170{
170 struct GNUNET_FS_GetIndexedContext *gic 171 struct GNUNET_FS_GetIndexedContext *gic
171 = GNUNET_new(struct GNUNET_FS_GetIndexedContext); 172 = GNUNET_new (struct GNUNET_FS_GetIndexedContext);
172 struct GNUNET_MQ_MessageHandler handlers[] = { 173 struct GNUNET_MQ_MessageHandler handlers[] = {
173 GNUNET_MQ_hd_fixed_size(index_info_end, 174 GNUNET_MQ_hd_fixed_size (index_info_end,
174 GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_END, 175 GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_END,
175 struct GNUNET_MessageHeader, 176 struct GNUNET_MessageHeader,
176 gic), 177 gic),
177 GNUNET_MQ_hd_var_size(index_info, 178 GNUNET_MQ_hd_var_size (index_info,
178 GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY, 179 GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY,
179 struct IndexInfoMessage, 180 struct IndexInfoMessage,
180 gic), 181 gic),
181 GNUNET_MQ_handler_end() 182 GNUNET_MQ_handler_end ()
182 }; 183 };
183 struct GNUNET_MQ_Envelope *env; 184 struct GNUNET_MQ_Envelope *env;
184 struct GNUNET_MessageHeader *msg; 185 struct GNUNET_MessageHeader *msg;
185 186
186 gic->mq = GNUNET_CLIENT_connect(h->cfg, 187 gic->mq = GNUNET_CLIENT_connect (h->cfg,
187 "fs", 188 "fs",
188 handlers, 189 handlers,
189 &mq_error_handler, 190 &mq_error_handler,
190 h); 191 h);
191 if (NULL == gic->mq) 192 if (NULL == gic->mq)
192 { 193 {
193 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 194 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
194 _("Failed to not connect to `%s' service.\n"), 195 _ ("Failed to not connect to `%s' service.\n"),
195 "fs"); 196 "fs");
196 GNUNET_free(gic); 197 GNUNET_free (gic);
197 return NULL; 198 return NULL;
198 } 199 }
199 gic->iterator = iterator; 200 gic->iterator = iterator;
200 gic->iterator_cls = iterator_cls; 201 gic->iterator_cls = iterator_cls;
201 env = GNUNET_MQ_msg(msg, 202 env = GNUNET_MQ_msg (msg,
202 GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET); 203 GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET);
203 GNUNET_MQ_send(gic->mq, 204 GNUNET_MQ_send (gic->mq,
204 env); 205 env);
205 return gic; 206 return gic;
206} 207}
207 208
@@ -212,10 +213,10 @@ GNUNET_FS_get_indexed_files(struct GNUNET_FS_Handle *h,
212 * @param gic operation to cancel 213 * @param gic operation to cancel
213 */ 214 */
214void 215void
215GNUNET_FS_get_indexed_files_cancel(struct GNUNET_FS_GetIndexedContext *gic) 216GNUNET_FS_get_indexed_files_cancel (struct GNUNET_FS_GetIndexedContext *gic)
216{ 217{
217 GNUNET_MQ_destroy(gic->mq); 218 GNUNET_MQ_destroy (gic->mq);
218 GNUNET_free(gic); 219 GNUNET_free (gic);
219} 220}
220 221
221 222