Skip to content

Commit

Permalink
doveadm: Remove CMD_PARAM_NONE type, since it already defaulted to sa…
Browse files Browse the repository at this point in the history
…me as CMD_PARAM_BOOL
  • Loading branch information
sirainen committed Feb 20, 2016
1 parent 382d45f commit 05128fd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/doveadm/client-connection-http.c
Expand Up @@ -233,7 +233,6 @@ static int doveadm_http_server_json_parse_next(struct client_connection_http *co
} else {
conn->cmd_param->value_set = TRUE;
switch(conn->cmd_param->type) {
case CMD_PARAM_NONE:
case CMD_PARAM_BOOL:
conn->cmd_param->value.v_bool = (strcmp(*value,"true")==0); break;
case CMD_PARAM_INT64:
Expand Down Expand Up @@ -523,7 +522,6 @@ doveadm_http_server_send_api(struct client_connection_http *conn)
o_stream_nsend_str(conn->client.output, str_c(tmp));
o_stream_nsend_str(conn->client.output, "\",\"type\":\"");
switch(par->type) {
case CMD_PARAM_NONE:
case CMD_PARAM_BOOL:
o_stream_nsend_str(conn->client.output, "boolean");
break;
Expand Down
3 changes: 1 addition & 2 deletions src/doveadm/doveadm-cmd.c
Expand Up @@ -187,7 +187,7 @@ bool doveadm_cmd_param_bool(int argc, const struct doveadm_cmd_param* params, co
const struct doveadm_cmd_param* param;
if ((param = doveadm_cmd_param_get(argc, params, name))==NULL) return FALSE;

if (param->type == CMD_PARAM_NONE || param->type == CMD_PARAM_BOOL) {
if (param->type == CMD_PARAM_BOOL) {
*value = param->value.v_bool;
return TRUE;
}
Expand Down Expand Up @@ -332,7 +332,6 @@ static void doveadm_fill_param(struct doveadm_cmd_param *param,
{
param->value_set = TRUE;
switch(param->type) {
case CMD_PARAM_NONE:
case CMD_PARAM_BOOL:
param->value.v_bool = TRUE; break;
case CMD_PARAM_INT64:
Expand Down
5 changes: 2 additions & 3 deletions src/doveadm/doveadm-cmd.h
Expand Up @@ -3,16 +3,15 @@

#define DOVEADM_CMD_PARAMS_START .parameters = (const struct doveadm_cmd_param[]){
#define DOVEADM_CMD_PARAM(optP, nameP, typeP, flagP ) { .opt = optP, .name = nameP, .type = typeP, .flags = flagP },
#define DOVEADM_CMD_PARAMS_END { .opt = NULL, .name = NULL, .type = CMD_PARAM_NONE, .flags = CMD_PARAM_FLAG_NONE } }
#define DOVEADM_CMD_PARAMS_END { .opt = NULL, .name = NULL, .type = CMD_PARAM_BOOL, .flags = CMD_PARAM_FLAG_NONE } }

struct doveadm_cmd_ver2;
struct doveadm_mail_cmd_context;

typedef void doveadm_command_t(int argc, char *argv[]);

typedef enum {
CMD_PARAM_NONE, /* same as below, used for empty */
CMD_PARAM_BOOL, /* value will contain 1 (not pointer) */
CMD_PARAM_BOOL = 0, /* value will contain 1 (not pointer) */
CMD_PARAM_INT64, /* ditto but contains number (not pointer) */
CMD_PARAM_STR, /* value contains const char* */
CMD_PARAM_ARRAY, /* value contains const char*[] */
Expand Down

0 comments on commit 05128fd

Please sign in to comment.