summaryrefslogtreecommitdiffhomepage
path: root/ir/libcore
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2012-12-06 06:33:02 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2012-12-06 06:35:54 +0100
commit6146f6cc0432381abad2c5584e2ef67771a13878 (patch)
treeb822f5162dcbde126a8f6199db5965586b6682ba /ir/libcore
parent34fe71502a5b13847aaa3781deddac70942ef523 (diff)
libcore: Remove LC_OPT_ENT_NEGBOOL() and LC_OPT_ENT_NEGBIT().
Avoid negative switches.
Diffstat (limited to 'ir/libcore')
-rw-r--r--ir/libcore/lc_opts.c18
-rw-r--r--ir/libcore/lc_opts.h8
2 files changed, 0 insertions, 26 deletions
diff --git a/ir/libcore/lc_opts.c b/ir/libcore/lc_opts.c
index 5d34a93..4db025f 100644
--- a/ir/libcore/lc_opts.c
+++ b/ir/libcore/lc_opts.c
@@ -176,8 +176,6 @@ static const char *get_type_name(lc_opt_type_t type)
XXX(double);
XXX(boolean);
XXX(string);
- case lc_opt_type_negbit: res = "bit"; break;
- case lc_opt_type_negboolean: res = "boolean"; break;
default:
res = "<none>";
}
@@ -360,22 +358,10 @@ int lc_opt_std_cb(const char *name, lc_opt_type_t type, void *data, size_t lengt
*(unsigned*)data &= ~length;
break;
- case lc_opt_type_negbit:
- integer = va_arg(args, int);
- if (integer)
- *(unsigned*)data &= ~length;
- else
- *(unsigned*)data |= length;
- break;
-
case lc_opt_type_boolean:
*((int *) data) = va_arg(args, int);
break;
- case lc_opt_type_negboolean:
- *((int *) data) = !va_arg(args, int);
- break;
-
case lc_opt_type_string:
strncpy((char*)data, va_arg(args, const char *), length);
break;
@@ -405,11 +391,9 @@ int lc_opt_std_dump(char *buf, size_t n, const char *name, lc_opt_type_t type, v
if (data) {
switch (type) {
case lc_opt_type_bit:
- case lc_opt_type_negbit:
res = snprintf(buf, n, "%x", *((unsigned *) data));
break;
case lc_opt_type_boolean:
- case lc_opt_type_negboolean:
res = snprintf(buf, n, "%s", *((int *) data) ? "true" : "false");
break;
case lc_opt_type_string:
@@ -501,9 +485,7 @@ int lc_opt_occurs(lc_opt_entry_t *opt, const char *value, lc_opt_err_info_t *err
break;
case lc_opt_type_boolean:
- case lc_opt_type_negboolean:
case lc_opt_type_bit:
- case lc_opt_type_negbit:
strtolower(buf, sizeof(buf), value);
for (i = 0; i < ARRAY_SIZE(bool_strings); ++i) {
if (strcmp(buf, bool_strings[i].str) == 0) {
diff --git a/ir/libcore/lc_opts.h b/ir/libcore/lc_opts.h
index 0dd6503..4e1e0e9 100644
--- a/ir/libcore/lc_opts.h
+++ b/ir/libcore/lc_opts.h
@@ -37,9 +37,7 @@ typedef enum {
lc_opt_type_invalid,
lc_opt_type_enum,
lc_opt_type_bit,
- lc_opt_type_negbit,
lc_opt_type_boolean,
- lc_opt_type_negboolean,
lc_opt_type_string,
lc_opt_type_int,
lc_opt_type_double
@@ -114,15 +112,9 @@ typedef struct {
#define LC_OPT_ENT_BIT(name, desc, addr, mask) \
_LC_OPT_ENT(name, desc, lc_opt_type_bit, unsigned, addr, mask, lc_opt_std_cb, lc_opt_std_dump, NULL)
-#define LC_OPT_ENT_NEGBIT(name, desc, addr, mask) \
- _LC_OPT_ENT(name, desc, lc_opt_type_negbit, unsigned, addr, mask, lc_opt_std_cb, lc_opt_std_dump, NULL)
-
#define LC_OPT_ENT_BOOL(name, desc, addr) \
_LC_OPT_ENT(name, desc, lc_opt_type_boolean, int, addr, 0, lc_opt_std_cb, lc_opt_std_dump, lc_opt_bool_dump_vals)
-#define LC_OPT_ENT_NEGBOOL(name, desc, addr) \
- _LC_OPT_ENT(name, desc, lc_opt_type_negboolean, int, addr, 0, lc_opt_std_cb, lc_opt_std_dump, lc_opt_bool_dump_vals)
-
typedef char lc_opt_str_t[];
#define LC_OPT_ENT_STR(name, desc, buf) \
_LC_OPT_ENT(name, desc, lc_opt_type_string, lc_opt_str_t, buf, sizeof(*buf), lc_opt_std_cb, lc_opt_std_dump, NULL)