Index: trunk/src/conf.c =================================================================== --- trunk/src/conf.c (revision 3419) +++ trunk/src/conf.c (revision 3420) @@ -887,7 +887,7 @@ } assert(array_size >= 1); - assert(htsp_get(conf_fields, (char *)path) == NULL); + assert(htsp_get(conf_fields, path) == NULL); node = calloc(sizeof(conf_native_t), 1); node->array_size = array_size; @@ -934,7 +934,7 @@ conf_native_t *conf_get_field(const char *path) { - return htsp_get(conf_fields, (char *)path); + return htsp_get(conf_fields, path); } int conf_set_dry(conf_role_t target, const char *path_, int arr_idx, const char *new_val, conf_policy_t pol) Index: trunk/src/funchash.c =================================================================== --- trunk/src/funchash.c (revision 3419) +++ trunk/src/funchash.c (revision 3420) @@ -42,17 +42,17 @@ static htpi_t *funchash; -static int keyeq(void *a_, void *b_) +static int keyeq(const void *a_, const void *b_) { - fh_key_t *a = a_, *b = b_; + const fh_key_t *a = a_, *b = b_; if (a->cookie != b->cookie) return 1; return !strcasecmp(a->key, b->key); } -static unsigned fh_hash(void *key) +static unsigned fh_hash(const void *key) { - fh_key_t *k = key; + const fh_key_t *k = key; return strhash_case((char *)k->key) ^ ptrhash((void *)k->cookie); } Index: trunk/src/hid_actions.c =================================================================== --- trunk/src/hid_actions.c (revision 3419) +++ trunk/src/hid_actions.c (revision 3420) @@ -14,16 +14,6 @@ #include "hid_actions.h" #include "compat_misc.h" -/* - * Ideally, we would like to look up values from the hash-table with the - * corresponding const-type of the key. We can't do this right now, - * (hzeller: can't write to genht repository), so this is an easy grep-able - * type that we have to type-cast to in look-ups. Can be removed after htsp - * can look up const char*'s. - */ - -typedef char *htsp_key_cast; - /* do not throw "unknown action" warning for these: they are known actions, the GUI HID may register them, but nothing bad happens if they are not registered or not handled by the GUI. */ @@ -69,7 +59,7 @@ Message(PCB_MSG_DEFAULT, _("ERROR! Invalid action name, " "action \"%s\" not registered.\n"), a[i].name); continue; } - if (htsp_get(all_actions, (htsp_key_cast)a[i].name) != NULL) { + if (htsp_get(all_actions, a[i].name) != NULL) { Message(PCB_MSG_DEFAULT, _("ERROR! Invalid action name, " "action \"%s\" is already registered.\n"), a[i].name); continue; } @@ -94,7 +84,7 @@ for (i = 0; i < n; i++) { htsp_entry_t *e; - e = htsp_popentry(all_actions, (htsp_key_cast)a[i].name); + e = htsp_popentry(all_actions, a[i].name); free(e->key); free(e->value); } @@ -125,7 +115,7 @@ if (all_actions == NULL) return; - e = htsp_popentry(all_actions, (htsp_key_cast)a->name); + e = htsp_popentry(all_actions, a->name); if (e != NULL) { free(e->key); free(e->value); Index: trunk/src/hid_color.c =================================================================== --- trunk/src/hid_color.c (revision 3419) +++ trunk/src/hid_color.c (revision 3420) @@ -6,7 +6,9 @@ static hidval invalid_color = { 0 }; +#define HT_HAS_CONST_KEY typedef char *htsh_key_t; +typedef const char *htsh_const_key_t; typedef hidval htsh_value_t; #define HT_INVALID_VALUE invalid_color #define HT(x) htsh_ ## x Index: trunk/src/plug_footprint.c =================================================================== --- trunk/src/plug_footprint.c (revision 3419) +++ trunk/src/plug_footprint.c (revision 3420) @@ -71,11 +71,11 @@ if (fp_tags == NULL) fp_tags = htsp_alloc(strhash, strkeyeq); - e = htsp_getentry(fp_tags, (char *) tag); + e = htsp_getentry(fp_tags, tag); if ((e == NULL) && alloc) { htsp_set(fp_tags, pcb_strdup(tag), (void *) counter); counter++; - e = htsp_getentry(fp_tags, (char *) tag); + e = htsp_getentry(fp_tags, tag); } return e == NULL ? NULL : e->key; } Index: trunk/src_plugins/propedit/props.c =================================================================== --- trunk/src_plugins/propedit/props.c (revision 3419) +++ trunk/src_plugins/propedit/props.c (revision 3420) @@ -66,7 +66,7 @@ /* Retrieve values for a prop */ pcb_props_t *pcb_props_get(htsp_t *props, const char *propname) { - return htsp_get(props, (char *)propname); + return htsp_get(props, propname); } /* Store a new value */ @@ -79,7 +79,7 @@ return NULL; /* look up or create the value list (p) associated with the property name */ - p = htsp_get(props, (char *)propname); + p = htsp_get(props, propname); if (p == NULL) { p = malloc(sizeof(pcb_props_t)); p->type = type; @@ -125,7 +125,7 @@ unsigned long best = 0, num_vals = 0; - p = htsp_get(props, (char *)propname); + p = htsp_get(props, propname); if (p == NULL) return NULL; @@ -206,7 +206,7 @@ const char *s; if (memcmp(cmd, "v1st", 4) == 0) { - ctx->qprop = htsp_get(ctx->core_props, (char *)key); + ctx->qprop = htsp_get(ctx->core_props, key); if (ctx->qprop == NULL) return NULL;