diff options
| author | “pengxuanzheng” <[email protected]> | 2021-09-22 18:12:00 +0800 |
|---|---|---|
| committer | “pengxuanzheng” <[email protected]> | 2021-09-22 18:21:09 +0800 |
| commit | 9250031fac8f5c5eec8c17498923315ea8a38a23 (patch) | |
| tree | f227c701f5ea702fc8e4155fdef5a88fa63b43c3 /src/hos_hash.cpp | |
| parent | d775b9d7e4d817e64ef3c959cd9b483474f1b880 (diff) | |
🐞 fix(TSG-7855): 修改哈希查找的类型
Diffstat (limited to 'src/hos_hash.cpp')
| -rw-r--r-- | src/hos_hash.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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) |
