From e9a1b3231c24b7eafda60b5cac11b08efa3e02ce Mon Sep 17 00:00:00 2001 From: russell Date: Tue, 28 Mar 2006 20:22:05 +0000 Subject: backport astmm + sparch fixes from the trunk git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@15743 f38db490-d61c-443f-a65b-d21fe96a405b --- astmm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'astmm.c') diff --git a/astmm.c b/astmm.c index 3f94e05fa..b542bc97a 100644 --- a/astmm.c +++ b/astmm.c @@ -37,6 +37,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 @@ -99,7 +100,7 @@ static inline void *__ast_alloc_region(size_t size, int which, const char *file, 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) { @@ -161,7 +162,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); @@ -296,7 +297,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); -- cgit v1.2.3