[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b
Török Edvin
edwin at clamav.net
Sun Apr 4 01:26:09 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit ded1cddc8c22a81e52e63f94ebeca8d481fe8f30
Author: Török Edvin <edwin at clamav.net>
Date: Wed Mar 24 17:59:41 2010 +0200
Add missing function.
diff --git a/libclamav/bytecode_api.c b/libclamav/bytecode_api.c
index afaea1f..3f1a0b2 100644
--- a/libclamav/bytecode_api.c
+++ b/libclamav/bytecode_api.c
@@ -504,8 +504,7 @@ int32_t cli_bcapi_hashset_remove(struct cli_bc_ctx *ctx , int32_t id, uint32_t k
struct cli_hashset *s = get_hashset(ctx, id);
if (!s)
return -1;
-// return cli_hashset_removekey(s, key);
- return -1;
+ return cli_hashset_removekey(s, key);
}
int32_t cli_bcapi_hashset_contains(struct cli_bc_ctx *ctx , int32_t id, uint32_t key)
diff --git a/libclamav/hashtab.c b/libclamav/hashtab.c
index d8f19be..fc99a81 100644
--- a/libclamav/hashtab.c
+++ b/libclamav/hashtab.c
@@ -453,6 +453,7 @@ void cli_hashset_destroy(struct cli_hashset* hs)
#define BITMAP_CONTAINS(bmap, val) ((bmap)[(val) >> 5] & (1 << ((val) & 0x1f)))
#define BITMAP_INSERT(bmap, val) ((bmap)[(val) >> 5] |= (1 << ((val) & 0x1f)))
+#define BITMAP_REMOVE(bmap, val) ((bmap)[(val) >> 5] &= ~(1 << ((val) & 0x1f)))
/*
* searches the hashset for the @key.
@@ -475,7 +476,6 @@ static inline size_t cli_hashset_search(const struct cli_hashset* hs, const uint
return idx;
}
-
static void cli_hashset_addkey_internal(struct cli_hashset* hs, const uint32_t key)
{
const size_t idx = cli_hashset_search(hs, key);
@@ -529,6 +529,16 @@ int cli_hashset_addkey(struct cli_hashset* hs, const uint32_t key)
return 0;
}
+int cli_hashset_removekey(struct cli_hashset* hs, const uint32_t key)
+{
+ const size_t idx = cli_hashset_search(hs, key);
+ if (BITMAP_CONTAINS(hs->bitmap, idx)) {
+ BITMAP_REMOVE(hs->bitmap, idx);
+ hs->keys[idx] = 0;
+ hs->count--;
+ }
+}
+
int cli_hashset_contains(const struct cli_hashset* hs, const uint32_t key)
{
const size_t idx = cli_hashset_search(hs, key);
diff --git a/libclamav/hashtab.h b/libclamav/hashtab.h
index 33f079e..8ab6786 100644
--- a/libclamav/hashtab.h
+++ b/libclamav/hashtab.h
@@ -104,6 +104,7 @@ int cli_hashset_contains(const struct cli_hashset* hs, const uint32_t key);
int cli_hashset_clear(struct cli_hashset* hs);
void cli_hashset_destroy(struct cli_hashset* hs);
ssize_t cli_hashset_toarray(const struct cli_hashset* hs, uint32_t** array);
+int cli_hashset_removekey(struct cli_hashset* hs, const uint32_t key);
/* Initializes the set without allocating memory, you can do lookups on it
* using _contains_maybe_noalloc. You need to initialize it using _init
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list