Wed, 03 Jun 2015 20:06:50 -0400
facebook: removed unnecessary gotos
--- a/libpurple/protocols/facebook/json.c Wed Jun 03 19:15:53 2015 -0400 +++ b/libpurple/protocols/facebook/json.c Wed Jun 03 20:06:50 2015 -0400 @@ -203,7 +203,8 @@ if (err != NULL) { g_propagate_error(error, err); - goto error; + json_node_free(node); + return NULL; } rslt = json_node_get_array(node); @@ -212,22 +213,20 @@ if (size < 1) { g_set_error(error, FB_JSON_ERROR, FB_JSON_ERROR_NOMATCH, _("No matches for %s"), expr); - goto error; + json_node_free(node); + return NULL; } if (size > 1) { g_set_error(error, FB_JSON_ERROR, FB_JSON_ERROR_AMBIGUOUS, _("Ambiguous matches for %s"), expr); - goto error; + json_node_free(node); + return NULL; } ret = json_array_dup_element(rslt, 0); json_node_free(node); return ret; - -error: - json_node_free(node); - return NULL; } JsonArray *
--- a/libpurple/protocols/facebook/json.h Wed Jun 03 19:15:53 2015 -0400 +++ b/libpurple/protocols/facebook/json.h Wed Jun 03 20:06:50 2015 -0400 @@ -67,9 +67,6 @@ fb_json_bldr_add_int(JsonBuilder *bldr, const gchar *name, gint64 value); void -fb_json_bldr_add_null(JsonBuilder *bldr, const gchar *name); - -void fb_json_bldr_add_str(JsonBuilder *bldr, const gchar *name, const gchar *value); void
--- a/libpurple/protocols/facebook/mqtt.c Wed Jun 03 19:15:53 2015 -0400 +++ b/libpurple/protocols/facebook/mqtt.c Wed Jun 03 20:06:50 2015 -0400 @@ -316,7 +316,9 @@ g_byte_array_append(priv->rbuf, &byte, sizeof byte); if (res != sizeof byte) { - goto error; + fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, + _("Failed to read fixed header")); + return; } mult = 1; @@ -326,7 +328,9 @@ g_byte_array_append(priv->rbuf, &byte, sizeof byte); if (res != sizeof byte) { - goto error; + fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, + _("Failed to read packet size")); + return; } priv->remz += (byte & 127) * mult; @@ -339,7 +343,9 @@ rize = purple_ssl_read(priv->gsc, buf, size); if (rize < 1) { - goto error; + fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, + _("Failed to read packet data")); + return; } g_byte_array_append(priv->rbuf, buf, rize); @@ -351,17 +357,14 @@ priv->remz = 0; if (G_UNLIKELY(msg == NULL)) { - goto error; + fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, + _("Failed to parse message")); + return; } fb_mqtt_read(mqtt, msg); g_object_unref(msg); } - - return; - -error: - fb_mqtt_error(mqtt, FB_MQTT_ERROR_GENERAL, _("Short read")); } void @@ -562,7 +565,6 @@ FbMqttMessage *msg; va_list ap; - g_return_if_fail(FB_IS_MQTT(mqtt)); g_return_if_fail(cid != NULL); g_return_if_fail(!fb_mqtt_connected(mqtt, FALSE)); @@ -611,8 +613,6 @@ { FbMqttMessage *msg; - g_return_if_fail(FB_IS_MQTT(mqtt)); - if (G_UNLIKELY(!fb_mqtt_connected(mqtt, FALSE))) { return; }