From 9250031fac8f5c5eec8c17498923315ea8a38a23 Mon Sep 17 00:00:00 2001 From: “pengxuanzheng” Date: Wed, 22 Sep 2021 18:12:00 +0800 Subject: 🐞 fix(TSG-7855): 修改哈希查找的类型 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hos_hash.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/hos_hash.cpp') diff --git a/src/hos_hash.cpp b/src/hos_hash.cpp index bb7e2538..22ff9954 100644 --- a/src/hos_hash.cpp +++ b/src/hos_hash.cpp @@ -8,7 +8,7 @@ void add_fd_context(hos_fd_context_t **handle, hos_fd_context_t *input) { hos_fd_context_t *value = NULL; - HASH_FIND_INT(*handle, (int *)&input->fd, value); + HASH_FIND(hh,*handle,&input->fd,sizeof(input->fd),value); if (value == NULL) { value = (hos_fd_context_t *)malloc(sizeof(hos_fd_context_t)); @@ -17,7 +17,7 @@ void add_fd_context(hos_fd_context_t **handle, hos_fd_context_t *input) value->bucket = (char *)calloc(1, strlen(input->bucket) + 1); memcpy(value->bucket, input->bucket, strlen(input->bucket)); memcpy(value->object, input->object, strlen(input->object)); - HASH_ADD_INT(*handle, fd, value); + HASH_ADD(hh,*handle,fd,sizeof(long),value); } else { @@ -50,7 +50,7 @@ void add_fd_context(hos_fd_context_t **handle, hos_fd_context_t *input) hos_fd_context_t *find_context_by_fd(hos_fd_context_t *handle, size_t fd) { hos_fd_context_t *value = NULL; - HASH_FIND_INT(handle, &fd, value); + HASH_FIND(hh,handle,&fd,sizeof(long),value); return value; } @@ -58,7 +58,7 @@ void delete_context_by_fd(hos_fd_context_t **handle, size_t fd) { hos_fd_context_t *value = NULL; - HASH_FIND_INT(*handle, &fd, value); + HASH_FIND(hh,*handle,&fd,sizeof(long),value); if (value) { if (value->bucket) -- cgit v1.2.3