[asterisk-commits] trunk r13631 - /trunk/astmm.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Mar 19 19:00:31 MST 2006


Author: russell
Date: Sun Mar 19 20:00:30 2006
New Revision: 13631

URL: http://svn.digium.com/view/asterisk?rev=13631&view=rev
Log:
fix astmm on sparc or any other architecture that doesn't allow unaligned
memory access

Modified:
    trunk/astmm.c

Modified: trunk/astmm.c
URL: http://svn.digium.com/view/asterisk/trunk/astmm.c?rev=13631&r1=13630&r2=13631&view=diff
==============================================================================
--- trunk/astmm.c (original)
+++ trunk/astmm.c Sun Mar 19 20:00:30 2006
@@ -38,6 +38,7 @@
 #include "asterisk/options.h"
 #include "asterisk/lock.h"
 #include "asterisk/strings.h"
+#include "asterisk/unaligned.h"
 
 #define SOME_PRIME 563
 
@@ -104,7 +105,7 @@
 		regions[hash] = reg;
 		reg->fence = FENCE_MAGIC;
 		fence = (ptr + reg->len);
-		*fence = FENCE_MAGIC;
+		put_unaligned_uint32(fence, FENCE_MAGIC);
 	}
 	ast_mutex_unlock(&reglock);
 	if (!reg) {
@@ -166,7 +167,7 @@
 				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 @@
 						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);



More information about the asterisk-commits mailing list