Fixed ticket #304: Memory alignment error for hash entry buffer causing crash on ARM (thanks ChenHuan)
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1307 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/hash.c b/pjlib/src/pj/hash.c
index 5b3454d..2e13f45 100644
--- a/pjlib/src/pj/hash.c
+++ b/pjlib/src/pj/hash.c
@@ -100,8 +100,8 @@
pj_hash_table_t *h;
unsigned table_size;
- /* Check that PJ_HASH_ENTRY_SIZE is correct. */
- PJ_ASSERT_RETURN(sizeof(pj_hash_entry)==PJ_HASH_ENTRY_SIZE, NULL);
+ /* Check that PJ_HASH_ENTRY_BUF_SIZE is correct. */
+ PJ_ASSERT_RETURN(sizeof(pj_hash_entry)<=PJ_HASH_ENTRY_BUF_SIZE, NULL);
h = PJ_POOL_ALLOC_T(pool, pj_hash_table_t);
h->count = 0;
@@ -237,11 +237,13 @@
PJ_DEF(void) pj_hash_set_np( pj_hash_table_t *ht,
const void *key, unsigned keylen,
- pj_uint32_t hval, void *entry_buf, void *value)
+ pj_uint32_t hval, pj_hash_entry_buf entry_buf,
+ void *value)
{
pj_hash_entry **p_entry;
- p_entry = find_entry( NULL, ht, key, keylen, value, &hval, entry_buf );
+ p_entry = find_entry( NULL, ht, key, keylen, value, &hval,
+ (void*)entry_buf );
if (*p_entry) {
if (value == NULL) {
/* delete entry */