Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/contact.c @ 20991:c8f99cb61dc9
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 19 Oct 2007 01:38:35 +0000 |
parents | cfaf74ec93dc |
children | aa875e77e5ce d31843a6b3bb ca624eda4267 c5df2bf2bf8e |
comparison
equal
deleted
inserted
replaced
20990:bc731b26335c | 20991:c8f99cb61dc9 |
---|---|
90 } | 90 } |
91 | 91 |
92 void | 92 void |
93 msn_callback_state_set_who(MsnCallbackState *state, const gchar *who) | 93 msn_callback_state_set_who(MsnCallbackState *state, const gchar *who) |
94 { | 94 { |
95 gchar *new_str = NULL; | |
96 | |
97 g_return_if_fail(state != NULL); | 95 g_return_if_fail(state != NULL); |
98 | 96 |
99 if (who != NULL) | |
100 new_str = g_strdup(who); | |
101 | |
102 g_free(state->who); | 97 g_free(state->who); |
103 state->who = new_str; | 98 state->who = g_strdup(who); |
104 } | 99 } |
105 | 100 |
106 void | 101 void |
107 msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid) | 102 msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid) |
108 { | 103 { |
109 gchar *new_str = NULL; | |
110 | |
111 g_return_if_fail(state != NULL); | 104 g_return_if_fail(state != NULL); |
112 | 105 |
113 if (uid != NULL) | |
114 new_str = g_strdup(uid); | |
115 | |
116 g_free(state->uid); | 106 g_free(state->uid); |
117 state->uid = new_str; | 107 state->uid = g_strdup(uid); |
118 } | 108 } |
119 | 109 |
120 void | 110 void |
121 msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name) | 111 msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name) |
122 { | 112 { |
123 gchar *new_str = NULL; | |
124 | |
125 g_return_if_fail(state != NULL); | 113 g_return_if_fail(state != NULL); |
126 | 114 |
127 if (old_group_name != NULL) | |
128 new_str = g_strdup(old_group_name); | |
129 | |
130 g_free(state->old_group_name); | 115 g_free(state->old_group_name); |
131 state->old_group_name = new_str; | 116 state->old_group_name = g_strdup(old_group_name); |
132 } | 117 } |
133 | 118 |
134 void | 119 void |
135 msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name) | 120 msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name) |
136 { | 121 { |
137 gchar *new_str = NULL; | |
138 | |
139 g_return_if_fail(state != NULL); | 122 g_return_if_fail(state != NULL); |
140 | 123 |
141 if (new_group_name != NULL) | |
142 new_str = g_strdup(new_group_name); | |
143 | |
144 g_free(state->new_group_name); | 124 g_free(state->new_group_name); |
145 state->new_group_name = new_str; | 125 state->new_group_name = g_strdup(new_group_name); |
146 } | 126 } |
147 | 127 |
148 void | 128 void |
149 msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid) | 129 msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid) |
150 { | 130 { |
151 gchar *new_str = NULL; | |
152 | |
153 g_return_if_fail(state != NULL); | 131 g_return_if_fail(state != NULL); |
154 | 132 |
155 if (guid != NULL) | |
156 new_str = g_strdup(guid); | |
157 | |
158 g_free(state->guid); | 133 g_free(state->guid); |
159 state->guid = new_str; | 134 state->guid = g_strdup(guid); |
160 } | 135 } |
161 | 136 |
162 | 137 |
163 void | 138 void |
164 msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id) | 139 msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id) |