From d0a9dcdcf53dfce14fad41166001b6c3ffb754bc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 22 Oct 2008 21:40:32 +0200 Subject: ack: converted ACK_ERROR_* macros to enum --- src/ack.h | 27 ++++++++++++++------------- src/command.c | 4 ++-- src/command.h | 3 ++- 3 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/ack.h b/src/ack.h index 1b2950e20..1bba007ca 100644 --- a/src/ack.h +++ b/src/ack.h @@ -19,19 +19,20 @@ #ifndef ACK_H #define ACK_H -/* Common Errors */ -#define ACK_ERROR_NOT_LIST 1 -#define ACK_ERROR_ARG 2 -#define ACK_ERROR_PASSWORD 3 -#define ACK_ERROR_PERMISSION 4 -#define ACK_ERROR_UNKNOWN 5 +enum ack { + ACK_ERROR_NOT_LIST = 1, + ACK_ERROR_ARG = 2, + ACK_ERROR_PASSWORD = 3, + ACK_ERROR_PERMISSION = 4, + ACK_ERROR_UNKNOWN = 5, -#define ACK_ERROR_NO_EXIST 50 -#define ACK_ERROR_PLAYLIST_MAX 51 -#define ACK_ERROR_SYSTEM 52 -#define ACK_ERROR_PLAYLIST_LOAD 53 -#define ACK_ERROR_UPDATE_ALREADY 54 -#define ACK_ERROR_PLAYER_SYNC 55 -#define ACK_ERROR_EXIST 56 + ACK_ERROR_NO_EXIST = 50, + ACK_ERROR_PLAYLIST_MAX = 51, + ACK_ERROR_SYSTEM = 52, + ACK_ERROR_PLAYLIST_LOAD = 53, + ACK_ERROR_UPDATE_ALREADY = 54, + ACK_ERROR_PLAYER_SYNC = 55, + ACK_ERROR_EXIST = 56, +}; #endif diff --git a/src/command.c b/src/command.c index 4ded86089..30d1af103 100644 --- a/src/command.c +++ b/src/command.c @@ -92,7 +92,7 @@ void command_success(struct client *client) client_puts(client, "OK\n"); } -static void command_error_v(struct client *client, int error, +static void command_error_v(struct client *client, enum ack error, const char *fmt, va_list args) { assert(client != NULL); @@ -106,7 +106,7 @@ static void command_error_v(struct client *client, int error, current_command = NULL; } -mpd_fprintf_ void command_error(struct client *client, int error, +mpd_fprintf_ void command_error(struct client *client, enum ack error, const char *fmt, ...) { va_list args; diff --git a/src/command.h b/src/command.h index 57b83fa5f..a1ee6474c 100644 --- a/src/command.h +++ b/src/command.h @@ -21,6 +21,7 @@ #include "gcc.h" #include "sllist.h" +#include "ack.h" #define COMMAND_RETURN_KILL 10 #define COMMAND_RETURN_CLOSE 20 @@ -39,7 +40,7 @@ void finishCommands(void); void command_success(struct client *client); -mpd_fprintf_ void command_error(struct client *client, int error, +mpd_fprintf_ void command_error(struct client *client, enum ack error, const char *fmt, ...); #endif -- cgit v1.2.3