be: Replace generate_emitter.pl by generate_emitter_new.pl.
[libfirm] / ir / libcore / lc_opts.c
index 665398a..5d34a93 100644 (file)
@@ -44,7 +44,7 @@ static struct obstack obst;
 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) \
@@ -232,9 +232,9 @@ lc_opt_entry_t *lc_opt_add_opt(lc_opt_entry_t *parent,
 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) {
@@ -611,7 +611,6 @@ static void lc_opt_print_help_rec(lc_opt_entry_t *ent, char separator, lc_opt_en
        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);
@@ -669,8 +668,6 @@ static void lc_opt_print_tree_grp_indent(lc_opt_entry_t *ent, FILE *f, int level
        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);
@@ -702,14 +699,14 @@ int lc_opt_from_single_arg(const lc_opt_entry_t *root,
 {
        const lc_opt_entry_t *grp = root;
        size_t n                  = strlen(arg);
-       size_t n_prefix           = opt_prefix ? strlen(opt_prefix) : 0;
+       size_t n_prefix           = opt_prefix != NULL ? strlen(opt_prefix) : 0;
        int error                 = 0;
        int ret                   = 0;
 
        lc_opt_err_info_t err;
        const char *end, *eqsign;
 
-       if (n >= n_prefix && strncmp(opt_prefix, arg, n_prefix) == 0) {
+       if (n >= n_prefix && (n_prefix == 0 || strncmp(opt_prefix, arg, n_prefix) == 0)) {
                arg = arg + n_prefix;
 
                /* find the next delimiter (the -) and extract the string up to