Skip to content
Snippets Groups Projects
Commit 2b11c917 authored by Frediano Ziglio's avatar Frediano Ziglio Committed by Frediano Ziglio
Browse files

Do not use GError to just return an error string

parent 4233df68
No related branches found
No related tags found
No related merge requests found
......@@ -796,22 +796,18 @@ static void mini_header_set_msg_sub_list(SpiceDataHeaderOpaque *header, uint32_t
bool RedChannelClient::init()
{
GError *local_error = NULL;
char *local_error = NULL;
SpiceCoreInterfaceInternal *core;
if (!priv->stream) {
g_set_error_literal(&local_error,
SPICE_SERVER_ERROR,
SPICE_SERVER_ERROR_FAILED,
"Socket not available");
local_error =
g_strdup_printf("Socket not available");
goto cleanup;
}
if (!config_socket()) {
g_set_error_literal(&local_error,
SPICE_SERVER_ERROR,
SPICE_SERVER_ERROR_FAILED,
"Unable to configure socket");
local_error =
g_strdup_printf("Unable to configure socket");
goto cleanup;
}
......@@ -844,8 +840,8 @@ cleanup:
if (local_error) {
red_channel_warning(get_channel(),
"Failed to create channel client: %s",
local_error->message);
g_error_free(local_error);
local_error);
g_free(local_error);
}
return local_error == NULL;
}
......@@ -1689,8 +1685,3 @@ bool RedChannelClient::set_migration_seamless()
return ret;
}
GQuark spice_server_error_quark(void)
{
return g_quark_from_static_string("spice-server-error-quark");
}
......@@ -203,14 +203,6 @@ private:
red::unique_link<RedChannelClientPrivate> priv;
};
#define SPICE_SERVER_ERROR spice_server_error_quark()
GQuark spice_server_error_quark(void);
typedef enum
{
SPICE_SERVER_ERROR_FAILED
} SpiceServerError;
/* Messages handled by RedChannel
* SET_ACK - sent to client on channel connection
* Note that the numbers don't have to correspond to spice message types,
......
......@@ -152,7 +152,7 @@ RedChannelClient *RedClient::get_channel(int type, int id)
return NULL;
}
gboolean RedClient::add_channel(RedChannelClient *rcc, GError **error)
gboolean RedClient::add_channel(RedChannelClient *rcc, char **error)
{
RedChannel *channel;
gboolean result = TRUE;
......@@ -165,21 +165,17 @@ gboolean RedClient::add_channel(RedChannelClient *rcc, GError **error)
uint32_t type = channel->type();
uint32_t id = channel->id();
if (disconnecting) {
g_set_error(error,
SPICE_SERVER_ERROR,
SPICE_SERVER_ERROR_FAILED,
"Client %p got disconnected while connecting channel type %d id %d",
this, type, id);
*error =
g_strdup_printf("Client %p got disconnected while connecting channel type %d id %d",
this, type, id);
result = FALSE;
goto cleanup;
}
if (get_channel(type, id)) {
g_set_error(error,
SPICE_SERVER_ERROR,
SPICE_SERVER_ERROR_FAILED,
"Client %p: duplicate channel type %d id %d",
this, type, id);
*error =
g_strdup_printf("Client %p: duplicate channel type %d id %d",
this, type, id);
result = FALSE;
goto cleanup;
}
......
......@@ -43,7 +43,7 @@ public:
*/
void destroy();
gboolean add_channel(RedChannelClient *rcc, GError **error);
gboolean add_channel(RedChannelClient *rcc, char **error);
static void remove_channel(RedChannelClient *rcc);
MainChannelClient *get_main();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment