Skip to content

Commit

Permalink
Rename HtXXListComparator to HtXXComparator
Browse files Browse the repository at this point in the history
  • Loading branch information
pelijah committed Apr 15, 2024
1 parent 045de95 commit 6f3e85b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion librz/bin/format/le/le.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static RZ_BORROW LE_import *le_add_import(rz_bin_le_obj_t *bin,
if (!bin->le_import_ht) {
HtPPOptions opt = {
.finiKV = (HtPPFiniKv)le_fini_import_kv,
.cmp = (HtPPListComparator)le_import_cmp,
.cmp = (HtPPComparator)le_import_cmp,
.hashfn = (HtPPHashFunction)le_import_hash,
};
CHECK(bin->le_import_ht = ht_pp_new_opt(&opt));
Expand Down
2 changes: 1 addition & 1 deletion librz/cons/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ RZ_API RzLineNSCompletionResult *rz_line_ns_completion_result_new(size_t start,
}
rz_pvector_init(&res->options, (RzPVectorFree)free);
HtPPOptions opt = { 0 };
opt.cmp = (HtPPListComparator)strcmp;
opt.cmp = (HtPPComparator)strcmp;
opt.hashfn = (HtPPHashFunction)sdb_hash;
res->options_ht = ht_pp_new_opt(&opt);
res->start = start;
Expand Down
1 change: 1 addition & 0 deletions librz/include/rz_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <rz_types.h>
#include <rz_util/ht_pp.h>
#include <ls.h>

#ifdef __cplusplus
extern "C" {
Expand Down
7 changes: 3 additions & 4 deletions librz/include/rz_util/ht_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ typedef enum {
} HtStrOption;
#endif

#include "ls.h"
#include <rz_types.h>

/* Kv represents a single key/value element in the hashtable */
Expand All @@ -109,7 +108,7 @@ typedef void (*HT_(FreeValue))(VALUE_TYPE val);
typedef ut32 (*HT_(CalcSizeK))(const KEY_TYPE);
typedef ut32 (*HT_(CalcSizeV))(const VALUE_TYPE);
typedef ut32 (*HT_(HashFunction))(const KEY_TYPE);
typedef int (*HT_(ListComparator))(const KEY_TYPE, const KEY_TYPE);
typedef int (*HT_(Comparator))(const KEY_TYPE, const KEY_TYPE);
typedef bool (*HT_(ForeachCallback))(void *user, const KEY_TYPE, const VALUE_TYPE);

typedef struct Ht_(bucket_t) {
Expand All @@ -122,8 +121,8 @@ HT_(Bucket);
* Options contain all the settings of the hashtable.
*/
typedef struct Ht_(options_t) {
HT_(ListComparator) cmp; ///< RZ_NULLABLE. Function for comparing keys.
///< Returns 0 if keys are equal.
HT_(Comparator) cmp; ///< RZ_NULLABLE. Function for comparing keys.
///< Returns 0 if keys are equal.
///< Function is invoked only if == operator applied to keys returns false.
HT_(HashFunction) hashfn; ///< RZ_NULLABLE. Function for hashing items in the hash table.
///< If NULL KEY_TO_HASH macro is used.
Expand Down
2 changes: 1 addition & 1 deletion librz/util/ht/ht_sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void fini_kv_val(HT_(Kv) *kv, void *user) {
*/
RZ_API RZ_OWN HtName_(Ht) *Ht_(new)(HtStrOption key_opt, RZ_NULLABLE HT_(DupValue) dup_val, RZ_NULLABLE HT_(FreeValue) free_val) {
HT_(Options) opt = {
.cmp = (HT_(ListComparator))strcmp,
.cmp = (HT_(Comparator))strcmp,
.hashfn = (HT_(HashFunction))sdb_hash,
.dupkey = key_opt == HT_STR_DUP ? (HT_(DupKey))strdup : NULL,
.dupvalue = dup_val,
Expand Down
2 changes: 1 addition & 1 deletion librz/util/ht/ht_ss.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static void fini_kv_val(HT_(Kv) *kv, void *user) {
*/
RZ_API RZ_OWN HtName_(Ht) *Ht_(new)(HtStrOption key_opt, HtStrOption val_opt) {
HT_(Options) opt = {
.cmp = (HT_(ListComparator))strcmp,
.cmp = (HT_(Comparator))strcmp,
.hashfn = (HT_(HashFunction))sdb_hash,
.dupkey = key_opt == HT_STR_DUP ? (HT_(DupKey))strdup : NULL,
.dupvalue = val_opt == HT_STR_DUP ? (HT_(DupValue))strdup : NULL,
Expand Down
2 changes: 1 addition & 1 deletion librz/util/ht/ht_su.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static void fini_kv_key(HT_(Kv) *kv, RZ_UNUSED void *user) {
*/
RZ_API RZ_OWN HtName_(Ht) *Ht_(new)(HtStrOption key_opt) {
HT_(Options) opt = {
.cmp = (HT_(ListComparator))strcmp,
.cmp = (HT_(Comparator))strcmp,
.hashfn = (HT_(HashFunction))sdb_hash,
.dupkey = key_opt == HT_STR_DUP ? (HT_(DupKey))strdup : NULL,
.dupvalue = NULL,
Expand Down

0 comments on commit 6f3e85b

Please sign in to comment.