1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[hash] const char *

This commit is contained in:
Witold Filipczyk 2021-03-03 14:12:31 +01:00
parent ce99b8889c
commit d20216cf53
4 changed files with 10 additions and 10 deletions

View File

@ -117,7 +117,7 @@ register_event(char *name)
}
int
get_event_id(char *name)
get_event_id(const char *name)
{
struct hash_item *item;
int namelen;

View File

@ -95,7 +95,7 @@ void unregister_event_hooks(struct event_hook_info *hooks);
* unregistration), thus it may be cached intermediatelly. */
/* It returns the event id on success or a negative number upon failure
* (ie. there is no such event). */
int get_event_id(char *name);
int get_event_id(const char *name);
/* This looks up the events table and returns the name of a given event
* @id. */

View File

@ -25,7 +25,7 @@
#define hash_mask(n) (hash_size(n) - 1)
#define hash_size(n) (1 << (n))
static hash_value_T strhash(char *k, unsigned int length, hash_value_T initval);
static hash_value_T strhash(const char *k, unsigned int length, hash_value_T initval);
static inline struct hash *
init_hash(unsigned int width, hash_func_T func)
@ -82,7 +82,7 @@ free_hash(struct hash **hashp)
/** @returns hash_item if ok, NULL if error.
* @relates hash */
struct hash_item *
add_hash_item(struct hash *hash, char *key, unsigned int keylen,
add_hash_item(struct hash *hash, const char *key, unsigned int keylen,
void *value)
{
hash_value_T hashval;
@ -103,7 +103,7 @@ add_hash_item(struct hash *hash, char *key, unsigned int keylen,
/** @relates hash */
struct hash_item *
get_hash_item(struct hash *hash, char *key, unsigned int keylen)
get_hash_item(struct hash *hash, const char *key, unsigned int keylen)
{
struct list_head *list;
struct hash_item *item;
@ -151,7 +151,7 @@ del_hash_item(struct hash *hash, struct hash_item *item)
* @param length the length of the key
* @param initval the previous hash, or an arbitrary value */
static hash_value_T
strhash(char *k,
strhash(const char *k,
unsigned int length,
hash_value_T initval)
{

View File

@ -11,12 +11,12 @@ extern "C" {
* happen when this will be of other length, but it should still work ok.
* --pasky */
typedef unsigned long hash_value_T;
typedef hash_value_T (* hash_func_T)(char *key, unsigned int keylen, hash_value_T magic);
typedef hash_value_T (* hash_func_T)(const char *key, unsigned int keylen, hash_value_T magic);
struct hash_item {
LIST_HEAD(struct hash_item);
char *key;
const char *key;
unsigned int keylen;
void *value;
};
@ -31,8 +31,8 @@ struct hash *init_hash8(void);
void free_hash(struct hash **hashp);
struct hash_item *add_hash_item(struct hash *hash, char *key, unsigned int keylen, void *value);
struct hash_item *get_hash_item(struct hash *hash, char *key, unsigned int keylen);
struct hash_item *add_hash_item(struct hash *hash, const char *key, unsigned int keylen, void *value);
struct hash_item *get_hash_item(struct hash *hash, const char *key, unsigned int keylen);
void del_hash_item(struct hash *hash, struct hash_item *item);
/** @relates hash */