#include "asterisk/options.h"
#include "asterisk/lock.h"
#include "asterisk/strings.h"
+#include "asterisk/unaligned.h"
#define SOME_PRIME 563
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) {
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);
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);