Mercurial > pidgin.yaz
diff src/gaim-client-example.c @ 14035:8bda65b88e49
[gaim-migrate @ 16638]
A bunch of small changes. Mostly remove "if not null" checks before
calling g_free, g_list_free, g_slist_free and g_strdup. Also use
g_list_foreach() to call g_free to free strings in an array. And
some whitespace changes here and there.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 05 Aug 2006 08:27:39 +0000 |
parents | c9312177821a |
children |
line wrap: on
line diff
--- a/src/gaim-client-example.c Sat Aug 05 05:42:28 2006 +0000 +++ b/src/gaim-client-example.c Sat Aug 05 08:27:39 2006 +0000 @@ -5,7 +5,7 @@ #include "gaim-client.h" -/* +/* This example demonstrates how to use libgaim-client to communicate with gaim. The names and signatures of functions provided by libgaim-client are the same as those in gaim. However, all @@ -21,19 +21,19 @@ int main (int argc, char **argv) { - GList *alist, *node; + GList *alist, *node; + + gaim_init(); - gaim_init(); - - alist = gaim_accounts_get_all(); - for (node = alist; node; node = node->next) { - GaimAccount *account = (GaimAccount*) node->data; - char *name = gaim_account_get_username(account); - g_print("Name: %s\n", name); - g_free(name); - } + alist = gaim_accounts_get_all(); + for (node = alist; node != NULL; node = node->next) + { + GaimAccount *account = (GaimAccount*) node->data; + char *name = gaim_account_get_username(account); + g_print("Name: %s\n", name); + g_free(name); + } + g_list_free(alist); - g_list_free(alist); - - return 0; + return 0; }