diff -r f9437ac8aa5d -r d6cb70301fea libpurple/protocols/facebook/api.c --- a/libpurple/protocols/facebook/api.c Sat Aug 01 16:49:23 2015 -0400 +++ b/libpurple/protocols/facebook/api.c Sat Aug 01 17:26:46 2015 -0400 @@ -23,8 +23,9 @@ #include #include +#include "glibcompat.h" + #include "api.h" -#include "glibcompat.h" #include "http.h" #include "json.h" #include "marshal.h" @@ -329,9 +330,8 @@ priv = api->priv; if (G_UNLIKELY(size == 0)) { - g_set_error(&err, FB_API_ERROR, FB_API_ERROR_GENERAL, - _("Invalid JSON data")); - FB_API_ERROR_CHK(api, err, return FALSE); + fb_api_error(api, FB_API_ERROR_GENERAL, _("Empty JSON data")); + return FALSE; } root = fb_json_node_new(data, size, &err); @@ -1043,19 +1043,15 @@ void fb_api_error(FbApi *api, FbApiError error, const gchar *format, ...) { - gchar *str; - GError *err = NULL; + GError *err; va_list ap; g_return_if_fail(FB_IS_API(api)); va_start(ap, format); - str = g_strdup_vprintf(format, ap); + err = g_error_new_valist(FB_API_ERROR, error, format, ap); va_end(ap); - g_set_error(&err, FB_API_ERROR, error, "%s", str); - g_free(str); - g_signal_emit_by_name(api, "error", err); g_error_free(err); }