#include "fsmonitor--daemon.h"
#include "simple-ipc.h"
-#include "khash.h"
+#include "strmap.h"
#include "run-command.h"
#include "trace.h"
#include "trace2.h"
return 0;
}
-KHASH_INIT(str, const char *, int, 0, kh_str_hash_func, kh_str_hash_equal)
-
static int do_handle_client(struct fsmonitor_daemon_state *state,
const char *command,
ipc_server_reply_cb *reply,
const struct fsmonitor_batch *batch;
struct fsmonitor_batch *remainder = NULL;
intmax_t count = 0, duplicates = 0;
- kh_str_t *shown = NULL;
- int hash_ret;
+ struct strset shown = STRSET_INIT;
int do_trivial = 0;
int do_flush = 0;
int do_cookie = 0;
* so walk the batch list backwards from the current head back
* to the batch (sequence number) they named.
*
- * We use khash to de-dup the list of pathnames.
+ * We use a strset to de-dup the list of pathnames.
*
* NEEDSWORK: each batch contains a list of interned strings,
* so we only need to do pointer comparisons here to build the
* hash table. Currently, we're still comparing the string
* values.
*/
- shown = kh_init_str();
+ strset_init_with_options(&shown, NULL, 0);
for (batch = batch_head;
batch && batch->batch_seq_nr > requested_oldest_seq_nr;
batch = batch->next) {
const char *s = batch->interned_paths[k];
size_t s_len;
- if (kh_get_str(shown, s) != kh_end(shown))
+ if (!strset_add(&shown, s))
duplicates++;
else {
- kh_put_str(shown, s, &hash_ret);
-
trace_printf_key(&trace_fsmonitor,
"send[%"PRIuMAX"]: %s",
count, s);
trace2_data_intmax("fsmonitor", the_repository, "response/count/duplicates", duplicates);
cleanup:
- kh_destroy_str(shown);
+ strset_clear(&shown);
strbuf_release(&response_token);
strbuf_release(&requested_token_id);
strbuf_release(&payload);