diff options
author | Max Kellermann <max@duempel.org> | 2013-08-10 18:02:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-04 18:14:22 +0200 |
commit | 29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch) | |
tree | 79766830b55ebca38ddbce84d8d548227eedb69e /src/AllCommands.cxx | |
parent | c9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff) | |
download | mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip |
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to 'src/AllCommands.cxx')
-rw-r--r-- | src/AllCommands.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/AllCommands.cxx b/src/AllCommands.cxx index 88eee150e..acd7d263e 100644 --- a/src/AllCommands.cxx +++ b/src/AllCommands.cxx @@ -32,6 +32,7 @@ #include "protocol/Result.hxx" #include "Client.hxx" #include "util/Tokenizer.hxx" +#include "util/Error.hxx" #ifdef ENABLE_SQLITE #include "StickerCommands.hxx" @@ -315,7 +316,7 @@ command_checked_lookup(Client *client, unsigned permission, enum command_return command_process(Client *client, unsigned num, char *line) { - GError *error = NULL; + Error error; char *argv[COMMAND_ARGV_MAX] = { NULL }; const struct command *cmd; enum command_return ret = COMMAND_RETURN_ERROR; @@ -325,17 +326,16 @@ command_process(Client *client, unsigned num, char *line) /* get the command name (first word on the line) */ Tokenizer tokenizer(line); - argv[0] = tokenizer.NextWord(&error); + argv[0] = tokenizer.NextWord(error); if (argv[0] == NULL) { current_command = ""; if (tokenizer.IsEnd()) command_error(client, ACK_ERROR_UNKNOWN, "No command given"); - else { + else command_error(client, ACK_ERROR_UNKNOWN, - "%s", error->message); - g_error_free(error); - } + "%s", error.GetMessage()); + current_command = NULL; return COMMAND_RETURN_ERROR; @@ -347,7 +347,7 @@ command_process(Client *client, unsigned num, char *line) while (argc < COMMAND_ARGV_MAX && (argv[argc] = - tokenizer.NextParam(&error)) != NULL) + tokenizer.NextParam(error)) != NULL) ++argc; /* some error checks; we have to set current_command because @@ -362,10 +362,8 @@ command_process(Client *client, unsigned num, char *line) } if (!tokenizer.IsEnd()) { - command_error(client, ACK_ERROR_ARG, - "%s", error->message); + command_error(client, ACK_ERROR_ARG, "%s", error.GetMessage()); current_command = NULL; - g_error_free(error); return COMMAND_RETURN_ERROR; } |