#include "lc_opts_enum.h"
#include "hashptr.h"
#include "lc_printf.h"
+#include "util.h"
#include "xmalloc.h"
#include "obst.h"
static void set_name(lc_opt_entry_t *ent, const char *name)
{
ent->name = name;
- ent->hash = HASH_STR(name, strlen(name));
+ ent->hash = hash_str(name);
}
#define entry_matches(ent,hash_val,str) \
static lc_opt_entry_t *lc_opt_find_ent(const struct list_head *head, const char *name,
int error_to_use, lc_opt_err_info_t *err)
{
- lc_opt_entry_t *ent, *found = NULL;
+ lc_opt_entry_t *found = NULL;
int error = error_to_use;
- unsigned hash = HASH_STR(name, strlen(name));
+ unsigned hash = hash_str(name);
if (!list_empty(head)) {
list_for_each_entry(lc_opt_entry_t, ent, head, list) {
{
unsigned i;
for (i = 0; i < n; ++i)
- buf[i] = tolower(str[i]);
+ buf[i] = tolower((unsigned char)str[i]);
return buf;
}
case lc_opt_type_bit:
integer = va_arg(args, int);
if (integer)
- *((int *) data) |= length;
+ *(unsigned*)data |= length;
else
- *((int *) data) &= ~length;
+ *(unsigned*)data &= ~length;
break;
case lc_opt_type_negbit:
integer = va_arg(args, int);
if (integer)
- *((int *) data) &= ~length;
+ *(unsigned*)data &= ~length;
else
- *((int *) data) |= length;
+ *(unsigned*)data |= length;
break;
case lc_opt_type_boolean:
case lc_opt_type_bit:
case lc_opt_type_negbit:
strtolower(buf, sizeof(buf), value);
- for (i = 0; i < LC_ARRSIZE(bool_strings); ++i) {
+ for (i = 0; i < ARRAY_SIZE(bool_strings); ++i) {
if (strcmp(buf, bool_strings[i].str) == 0) {
val->integer = bool_strings[i].val;
error = lc_opt_err_none;
char grp_name[512];
char value[256];
char values[512];
- lc_opt_entry_t *e;
if (!list_empty(&s->opts)) {
lc_opt_print_grp_path(grp_name, sizeof(grp_name), ent, separator, stop_ent);
lc_grp_special_t *s;
if (ent->is_grp) {
- lc_opt_entry_t *e;
-
s = lc_get_grp_special(ent);
indent(f, level);
fprintf(f, "/%s\n", ent->name);