diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-20 02:00:30 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-20 02:00:30 +0000 |
commit | c9b332ca22346b30293ecbe6142e9c2e5ac9b1e9 (patch) | |
tree | fe79563dcce7311827e5114f62231488ac7f082c /astmm.c | |
parent | 8275cee2387ff946cab355b47ecb270cfa94d0e2 (diff) |
fix astmm on sparc or any other architecture that doesn't allow unaligned
memory access
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13631 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'astmm.c')
-rw-r--r-- | astmm.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -38,6 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/options.h" #include "asterisk/lock.h" #include "asterisk/strings.h" +#include "asterisk/unaligned.h" #define SOME_PRIME 563 @@ -104,7 +105,7 @@ static inline void *__ast_alloc_region(size_t size, const enum func_type which, regions[hash] = reg; reg->fence = FENCE_MAGIC; fence = (ptr + reg->len); - *fence = FENCE_MAGIC; + put_unaligned_uint32(fence, FENCE_MAGIC); } ast_mutex_unlock(®lock); if (!reg) { @@ -166,7 +167,7 @@ static void __ast_free_region(void *ptr, const char *file, int lineno, const cha fflush(mmlog); } } - if (*fence != FENCE_MAGIC) { + if (get_unaligned_uint32(fence) != FENCE_MAGIC) { fprintf(stderr, "WARNING: High fence violation at %p, in %s of %s, line %d\n", reg->data, reg->func, reg->file, reg->lineno); if (mmlog) { fprintf(mmlog, "%ld - WARNING: High fence violation at %p, in %s of %s, line %d\n", time(NULL), reg->data, reg->func, reg->file, reg->lineno); @@ -316,7 +317,7 @@ static int handle_show_memory(int fd, int argc, char *argv[]) fflush(mmlog); } } - if (*fence != FENCE_MAGIC) { + if (get_unaligned_uint32(fence) != FENCE_MAGIC) { fprintf(stderr, "WARNING: High fence violation at %p, in %s of %s, line %d\n", reg->data, reg->func, reg->file, reg->lineno); if (mmlog) { fprintf(mmlog, "%ld - WARNING: High fence violation at %p, in %s of %s, line %d\n", time(NULL), reg->data, reg->func, reg->file, reg->lineno); |