Kouhei Sutou
null+****@clear*****
Wed Dec 12 18:32:28 JST 2012
Kouhei Sutou 2012-12-12 18:32:28 +0900 (Wed, 12 Dec 2012) New Revision: 4318f16fb9035a730245d6efe4f93676866a83cc https://github.com/groonga/groonga/commit/4318f16fb9035a730245d6efe4f93676866a83cc Log: Use UPPER_CASE for grn_str_getopt_op enum values GitHub: #43 Modified files: lib/str.c lib/str.h src/grnslap.c src/groonga.c src/groonga_benchmark.c src/suggest/groonga_suggest_httpd.c Modified: lib/str.c (+4 -4) =================================================================== --- lib/str.c 2012-12-12 18:04:32 +0900 (8fad590) +++ lib/str.c 2012-12-12 18:32:28 +0900 (d016a16) @@ -1791,15 +1791,15 @@ op_getopt_flag(int *flags, const grn_str_getopt_opt *o, int argc, char * const argv[], int i, const char *optvalue) { switch (o->op) { - case getopt_op_none: + case GETOPT_OP_NONE: break; - case getopt_op_on: + case GETOPT_OP_ON: *flags |= o->flag; break; - case getopt_op_off: + case GETOPT_OP_OFF: *flags &= ~o->flag; break; - case getopt_op_update: + case GETOPT_OP_UPDATE: *flags = o->flag; break; default: Modified: lib/str.h (+4 -4) =================================================================== --- lib/str.h 2012-12-12 18:04:32 +0900 (2353bed) +++ lib/str.h 2012-12-12 18:32:28 +0900 (cdd1291) @@ -30,10 +30,10 @@ extern "C" { #endif typedef enum { - getopt_op_none = 0, - getopt_op_on, - getopt_op_off, - getopt_op_update + GETOPT_OP_NONE = 0, + GETOPT_OP_ON, + GETOPT_OP_OFF, + GETOPT_OP_UPDATE } grn_str_getopt_op; typedef struct { Modified: src/grnslap.c (+5 -5) =================================================================== --- src/grnslap.c 2012-12-12 18:04:32 +0900 (afe26bc) +++ src/grnslap.c 2012-12-12 18:32:28 +0900 (5400fbb) @@ -329,11 +329,11 @@ main(int argc, char **argv) const char *protostr = NULL, *maxconstr = NULL, *maxtpstr = NULL; int r, i, flags = 0; static grn_str_getopt_opt opts[] = { - {'P', NULL, NULL, 0, getopt_op_none}, - {'m', NULL, NULL, 0, getopt_op_none}, - {'t', NULL, NULL, 0, getopt_op_none}, - {'h', NULL, NULL, flag_usage, getopt_op_on}, - {'v', NULL, NULL, flag_verbose, getopt_op_on}, + {'P', NULL, NULL, 0, GETOPT_OP_NONE}, + {'m', NULL, NULL, 0, GETOPT_OP_NONE}, + {'t', NULL, NULL, 0, GETOPT_OP_NONE}, + {'h', NULL, NULL, flag_usage, GETOPT_OP_ON}, + {'v', NULL, NULL, flag_verbose, GETOPT_OP_ON}, {'\0', NULL, NULL, 0, 0} }; opts[0].arg = &protostr; Modified: src/groonga.c (+31 -31) =================================================================== --- src/groonga.c 2012-12-12 18:04:32 +0900 (2d82972) +++ src/groonga.c 2012-12-12 18:32:28 +0900 (c15464d) @@ -1864,24 +1864,24 @@ show_config(FILE *out, const grn_str_getopt_opt *opts, int flags) for (o = opts; o->opt || o->longopt; o++) { switch (o->op) { - case getopt_op_none: + case GETOPT_OP_NONE: if (o->arg && *o->arg) { if (o->longopt && strcmp(o->longopt, "config-path")) { fprintf(out, "%s=%s\n", o->longopt, *o->arg); } } break; - case getopt_op_on: + case GETOPT_OP_ON: if (flags & o->flag) { goto no_arg; } break; - case getopt_op_off: + case GETOPT_OP_OFF: if (!(flags & o->flag)) { goto no_arg; } break; - case getopt_op_update: + case GETOPT_OP_UPDATE: if (flags == o->flag) { no_arg: if (o->longopt) { @@ -2042,33 +2042,33 @@ main(int argc, char **argv) int exit_code = EXIT_SUCCESS; int i, mode = mode_alone; static grn_str_getopt_opt opts[] = { - {'p', "port", NULL, 0, getopt_op_none}, - {'e', "encoding", NULL, 0, getopt_op_none}, - {'t', "max-threads", NULL, 0, getopt_op_none}, - {'h', "help", NULL, mode_usage, getopt_op_update}, - {'c', NULL, NULL, mode_client, getopt_op_update}, - {'d', NULL, NULL, mode_daemon, getopt_op_update}, - {'s', NULL, NULL, mode_server, getopt_op_update}, - {'l', "log-level", NULL, 0, getopt_op_none}, - {'i', "server-id", NULL, 0, getopt_op_none}, - {'q', NULL, NULL, MODE_USE_QL, getopt_op_on}, - {'n', NULL, NULL, MODE_NEW_DB, getopt_op_on}, - {'\0', "protocol", NULL, 0, getopt_op_none}, - {'\0', "version", NULL, mode_version, getopt_op_update}, - {'\0', "log-path", NULL, 0, getopt_op_none}, - {'\0', "query-log-path", NULL, 0, getopt_op_none}, - {'\0', "pid-path", NULL, 0, getopt_op_none}, - {'\0', "config-path", NULL, 0, getopt_op_none}, - {'\0', "show-config", NULL, mode_config, getopt_op_update}, - {'\0', "cache-limit", NULL, 0, getopt_op_none}, - {'\0', "file", NULL, 0, getopt_op_none}, - {'\0', "document-root", NULL, 0, getopt_op_none}, - {'\0', "default-command-version", NULL, 0, getopt_op_none}, - {'\0', "default-match-escalation-threshold", NULL, 0, getopt_op_none}, - {'\0', "bind-address", NULL, 0, getopt_op_none}, - {'\0', "input-fd", NULL, 0, getopt_op_none}, - {'\0', "output-fd", NULL, 0, getopt_op_none}, - {'\0', "working-directory", NULL, 0, getopt_op_none}, + {'p', "port", NULL, 0, GETOPT_OP_NONE}, + {'e', "encoding", NULL, 0, GETOPT_OP_NONE}, + {'t', "max-threads", NULL, 0, GETOPT_OP_NONE}, + {'h', "help", NULL, mode_usage, GETOPT_OP_UPDATE}, + {'c', NULL, NULL, mode_client, GETOPT_OP_UPDATE}, + {'d', NULL, NULL, mode_daemon, GETOPT_OP_UPDATE}, + {'s', NULL, NULL, mode_server, GETOPT_OP_UPDATE}, + {'l', "log-level", NULL, 0, GETOPT_OP_NONE}, + {'i', "server-id", NULL, 0, GETOPT_OP_NONE}, + {'q', NULL, NULL, MODE_USE_QL, GETOPT_OP_ON}, + {'n', NULL, NULL, MODE_NEW_DB, GETOPT_OP_ON}, + {'\0', "protocol", NULL, 0, GETOPT_OP_NONE}, + {'\0', "version", NULL, mode_version, GETOPT_OP_UPDATE}, + {'\0', "log-path", NULL, 0, GETOPT_OP_NONE}, + {'\0', "query-log-path", NULL, 0, GETOPT_OP_NONE}, + {'\0', "pid-path", NULL, 0, GETOPT_OP_NONE}, + {'\0', "config-path", NULL, 0, GETOPT_OP_NONE}, + {'\0', "show-config", NULL, mode_config, GETOPT_OP_UPDATE}, + {'\0', "cache-limit", NULL, 0, GETOPT_OP_NONE}, + {'\0', "file", NULL, 0, GETOPT_OP_NONE}, + {'\0', "document-root", NULL, 0, GETOPT_OP_NONE}, + {'\0', "default-command-version", NULL, 0, GETOPT_OP_NONE}, + {'\0', "default-match-escalation-threshold", NULL, 0, GETOPT_OP_NONE}, + {'\0', "bind-address", NULL, 0, GETOPT_OP_NONE}, + {'\0', "input-fd", NULL, 0, GETOPT_OP_NONE}, + {'\0', "output-fd", NULL, 0, GETOPT_OP_NONE}, + {'\0', "working-directory", NULL, 0, GETOPT_OP_NONE}, {'\0', NULL, NULL, 0, 0} }; opts[0].arg = &port_arg; Modified: src/groonga_benchmark.c (+14 -14) =================================================================== --- src/groonga_benchmark.c 2012-12-12 18:04:32 +0900 (99722b3) +++ src/groonga_benchmark.c 2012-12-12 18:32:28 +0900 (dd47f8f) @@ -2951,20 +2951,20 @@ main(int argc, char **argv) time_t sec; static grn_str_getopt_opt opts[] = { - {'i', "host", NULL, 0, getopt_op_none}, - {'p', "port", NULL, 0, getopt_op_none}, - {'\0', "log-output-dir", NULL, 0, getopt_op_none}, - {'\0', "output-type", NULL, 0, getopt_op_none}, - {'\0', "dir", NULL, mode_list, getopt_op_update}, - {'\0', "ftp", NULL, MODE_FTP, getopt_op_on}, - {'h', "help", NULL, mode_usage, getopt_op_update}, - {'\0', "localonly", NULL, MODE_LOCALONLY, getopt_op_on}, - {'\0', "onmemory", NULL, MODE_ONMEMORY, getopt_op_on}, - {'\0', "owndb", NULL, MODE_OWNDB, getopt_op_on}, - {'\0', "groonga", NULL, 0, getopt_op_none}, - {'\0', "protocol", NULL, 0, getopt_op_none}, - {'\0', "log-path", NULL, 0, getopt_op_none}, - {'\0', "pid-path", NULL, 0, getopt_op_none}, + {'i', "host", NULL, 0, GETOPT_OP_NONE}, + {'p', "port", NULL, 0, GETOPT_OP_NONE}, + {'\0', "log-output-dir", NULL, 0, GETOPT_OP_NONE}, + {'\0', "output-type", NULL, 0, GETOPT_OP_NONE}, + {'\0', "dir", NULL, mode_list, GETOPT_OP_UPDATE}, + {'\0', "ftp", NULL, MODE_FTP, GETOPT_OP_ON}, + {'h', "help", NULL, mode_usage, GETOPT_OP_UPDATE}, + {'\0', "localonly", NULL, MODE_LOCALONLY, GETOPT_OP_ON}, + {'\0', "onmemory", NULL, MODE_ONMEMORY, GETOPT_OP_ON}, + {'\0', "owndb", NULL, MODE_OWNDB, GETOPT_OP_ON}, + {'\0', "groonga", NULL, 0, GETOPT_OP_NONE}, + {'\0', "protocol", NULL, 0, GETOPT_OP_NONE}, + {'\0', "log-path", NULL, 0, GETOPT_OP_NONE}, + {'\0', "pid-path", NULL, 0, GETOPT_OP_NONE}, {'\0', NULL, NULL, 0, 0} }; Modified: src/suggest/groonga_suggest_httpd.c (+11 -11) =================================================================== --- src/suggest/groonga_suggest_httpd.c 2012-12-12 18:04:32 +0900 (a424267) +++ src/suggest/groonga_suggest_httpd.c 2012-12-12 18:32:28 +0900 (b856bea) @@ -727,18 +727,18 @@ main(int argc, char **argv) /* parse options */ { static grn_str_getopt_opt opts[] = { - {'c', NULL, NULL, 0, getopt_op_none}, /* deprecated */ - {'t', "n-threads", NULL, 0, getopt_op_none}, - {'h', "help", NULL, run_mode_usage, getopt_op_update}, - {'p', "port", NULL, 0, getopt_op_none}, - {'\0', "bind-address", NULL, 0, getopt_op_none}, /* not supported yet */ - {'s', "send-endpoint", NULL, 0, getopt_op_none}, - {'r', "receive-endpoint", NULL, 0, getopt_op_none}, - {'l', "log-base-path", NULL, 0, getopt_op_none}, - {'\0', "n-lines-per-log-file", NULL, 0, getopt_op_none}, - {'d', "daemon", NULL, run_mode_daemon, getopt_op_update}, + {'c', NULL, NULL, 0, GETOPT_OP_NONE}, /* deprecated */ + {'t', "n-threads", NULL, 0, GETOPT_OP_NONE}, + {'h', "help", NULL, run_mode_usage, GETOPT_OP_UPDATE}, + {'p', "port", NULL, 0, GETOPT_OP_NONE}, + {'\0', "bind-address", NULL, 0, GETOPT_OP_NONE}, /* not supported yet */ + {'s', "send-endpoint", NULL, 0, GETOPT_OP_NONE}, + {'r', "receive-endpoint", NULL, 0, GETOPT_OP_NONE}, + {'l', "log-base-path", NULL, 0, GETOPT_OP_NONE}, + {'\0', "n-lines-per-log-file", NULL, 0, GETOPT_OP_NONE}, + {'d', "daemon", NULL, run_mode_daemon, GETOPT_OP_UPDATE}, {'\0', "disable-max-fd-check", NULL, RUN_MODE_ENABLE_MAX_FD_CHECK, - getopt_op_off}, + GETOPT_OP_OFF}, {'\0', NULL, NULL, 0, 0} }; opts[0].arg = &max_threads_string; -------------- next part -------------- HTML����������������������������... Descargar