Mercurial > pidgin.yaz
comparison src/value.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 | fde4101fa183 |
children |
comparison
equal
deleted
inserted
replaced
14034:0839a7b71325 | 14035:8bda65b88e49 |
---|---|
83 { | 83 { |
84 g_return_if_fail(value != NULL); | 84 g_return_if_fail(value != NULL); |
85 | 85 |
86 if (gaim_value_get_type(value) == GAIM_TYPE_BOXED) | 86 if (gaim_value_get_type(value) == GAIM_TYPE_BOXED) |
87 { | 87 { |
88 if (value->u.specific_type != NULL) | 88 g_free(value->u.specific_type); |
89 g_free(value->u.specific_type); | |
90 } | 89 } |
91 else if (gaim_value_get_type(value) == GAIM_TYPE_STRING) | 90 else if (gaim_value_get_type(value) == GAIM_TYPE_STRING) |
92 { | 91 { |
93 if (value->data.string_data != NULL) | 92 g_free(value->data.string_data); |
94 g_free(value->data.string_data); | |
95 } | 93 } |
96 | 94 |
97 g_free(value); | 95 g_free(value); |
98 } | 96 } |
99 | 97 |
320 void | 318 void |
321 gaim_value_set_string(GaimValue *value, const char *data) | 319 gaim_value_set_string(GaimValue *value, const char *data) |
322 { | 320 { |
323 g_return_if_fail(value != NULL); | 321 g_return_if_fail(value != NULL); |
324 | 322 |
325 if (value->data.string_data != NULL) | 323 g_free(value->data.string_data); |
326 g_free(value->data.string_data); | 324 value->data.string_data = g_strdup(data); |
327 | |
328 value->data.string_data = (data == NULL ? NULL : g_strdup(data)); | |
329 } | 325 } |
330 | 326 |
331 void | 327 void |
332 gaim_value_set_object(GaimValue *value, void *data) | 328 gaim_value_set_object(GaimValue *value, void *data) |
333 { | 329 { |