[asterisk-commits] branch 1.2 r15743 - in /branches/1.2: agi/Makefile astmm.c strcompat.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Mar 28 13:22:12 MST 2006


Author: russell
Date: Tue Mar 28 14:22:05 2006
New Revision: 15743

URL: http://svn.digium.com/view/asterisk?rev=15743&view=rev
Log:
backport astmm + sparch fixes from the trunk

Modified:
    branches/1.2/agi/Makefile
    branches/1.2/astmm.c
    branches/1.2/strcompat.c

Modified: branches/1.2/agi/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.2/agi/Makefile?rev=15743&r1=15742&r2=15743&view=diff
==============================================================================
--- branches/1.2/agi/Makefile (original)
+++ branches/1.2/agi/Makefile Tue Mar 28 14:22:05 2006
@@ -13,7 +13,7 @@
 
 AGIS=agi-test.agi eagi-test eagi-sphinx-test
 
-CFLAGS+=
+CFLAGS+=-DNO_AST_MM
 
 LIBS=
 ifeq ($(OSARCH),SunOS)

Modified: branches/1.2/astmm.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/astmm.c?rev=15743&r1=15742&r2=15743&view=diff
==============================================================================
--- branches/1.2/astmm.c (original)
+++ branches/1.2/astmm.c Tue Mar 28 14:22:05 2006
@@ -37,6 +37,7 @@
 #include "asterisk/options.h"
 #include "asterisk/lock.h"
 #include "asterisk/strings.h"
+#include "asterisk/unaligned.h"
 
 #define SOME_PRIME 563
 
@@ -99,7 +100,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) {
@@ -161,7 +162,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);
@@ -296,7 +297,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);

Modified: branches/1.2/strcompat.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/strcompat.c?rev=15743&r1=15742&r2=15743&view=diff
==============================================================================
--- branches/1.2/strcompat.c (original)
+++ branches/1.2/strcompat.c Tue Mar 28 14:22:05 2006
@@ -33,21 +33,18 @@
 int setenv(const char *name, const char *value, int overwrite)
 {
 	unsigned char *buf;
-	int buflen, ret;
+	int buflen;
 
 	buflen = strlen(name) + strlen(value) + 2;
-	if ((buf = malloc(buflen)) == NULL)
+	if (!(buf = alloca(buflen)))
  		return -1;
 
 	if (!overwrite && getenv(name))
 		return 0;
 
 	snprintf(buf, buflen, "%s=%s", name, value);
-	ret = putenv(buf);
 
-	free(buf);
-
-	return ret;
+	return putenv(buf);
 }
 
 int unsetenv(const char *name)



More information about the asterisk-commits mailing list