Changeset d5c55ac
- Timestamp:
- 2015-02-22T21:19:21Z (10 years ago)
- Branches:
- master
- Children:
- 273949d
- Parents:
- 5ff4618
- git-author:
- dequis <dx@…> (23-01-15 07:01:05)
- git-committer:
- dequis <dx@…> (22-02-15 21:19:21)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
r5ff4618 rd5c55ac 259 259 260 260 261 static gboolean xml_generate_nick(gpointer key, gpointer value, gpointer data);262 261 static void xml_generate_settings(struct xt_node *cur, set_t **head); 263 262 … … 292 291 293 292 for (acc = irc->b->accounts; acc; acc = acc->next) { 293 GHashTableIter iter; 294 gpointer key, value; 294 295 unsigned char *pass_cr; 295 296 char *pass_b64; … … 312 313 g_free(pass_b64); 313 314 314 /* This probably looks pretty strange. g_hash_table_foreach 315 is quite a PITA already (but it can't get much better in 316 C without using #define, I'm afraid), and it 317 doesn't seem to be possible to abort the foreach on write 318 errors, so instead let's use the _find function and 319 return TRUE on write errors. Which means, if we found 320 something, there was an error. :-) */ 321 g_hash_table_find(acc->nicks, xml_generate_nick, cur); 315 g_hash_table_iter_init(&iter, acc->nicks); 316 while (g_hash_table_iter_next(&iter, &key, &value)) { 317 struct xt_node *node = xt_new_node("buddy", NULL, NULL); 318 xt_add_attr(node, "handle", key); 319 xt_add_attr(node, "nick", value); 320 xt_add_child(cur, node); 321 } 322 322 323 323 xml_generate_settings(cur, &acc->set); … … 343 343 344 344 return root; 345 }346 347 static gboolean xml_generate_nick(gpointer key, gpointer value, gpointer data)348 {349 struct xt_node *node = xt_new_node("buddy", NULL, NULL);350 351 xt_add_attr(node, "handle", key);352 xt_add_attr(node, "nick", value);353 xt_add_child((struct xt_node *) data, node);354 355 return FALSE;356 345 } 357 346
Note: See TracChangeset
for help on using the changeset viewer.