[xiph-cvs] cvs commit: speex/libspeex nb_celp.c stack_alloc.h
Jean-Marc Valin
jm at xiph.org
Thu Feb 12 00:30:17 PST 2004
jm 04/02/12 03:30:17
Modified: libspeex nb_celp.c stack_alloc.h
Log:
added extra valgrind checks for the Speex stack
Revision Changes Path
1.164 +6 -0 speex/libspeex/nb_celp.c
Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -r1.163 -r1.164
--- nb_celp.c 23 Dec 2003 08:11:13 -0000 1.163
+++ nb_celp.c 12 Feb 2004 08:30:16 -0000 1.164
@@ -198,6 +198,9 @@
st->sampling_rate=8000;
st->dtx_count=0;
+#ifdef ENABLE_VALGRIND
+ VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
+#endif
return st;
}
@@ -1005,6 +1008,9 @@
st->voc_m1=st->voc_m2=st->voc_mean=0;
st->voc_offset=0;
st->dtx_enabled=0;
+#ifdef ENABLE_VALGRIND
+ VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
+#endif
return st;
}
<p><p>1.13 +18 -0 speex/libspeex/stack_alloc.h
Index: stack_alloc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/stack_alloc.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- stack_alloc.h 13 Jun 2003 03:59:46 -0000 1.12
+++ stack_alloc.h 12 Feb 2004 08:30:16 -0000 1.13
@@ -34,6 +34,21 @@
#ifndef STACK_ALLOC_H
#define STACK_ALLOC_H
+#ifdef ENABLE_VALGRIND
+
+#include <valgrind/memcheck.h>
+/*Aligns the stack to a 'size' boundary */
+#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
+
+/* Allocates 'size' elements of type 'type' on the stack */
+#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
+
+/* Allocates a struct stack */
+#define PUSHS(stack, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(long)),VALGRIND_MAKE_WRITABLE(stack, (sizeof(type))),(stack)+=(sizeof(type)),(type*)((stack)-(sizeof(type))))
+
+#else
+
+
/*Aligns the stack to a 'size' boundary */
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
@@ -43,5 +58,8 @@
/* Allocates a struct stack */
#define PUSHS(stack, type) (ALIGN((stack),sizeof(long)),(stack)+=(sizeof(type)),(type*)((stack)-(sizeof(type))))
+#endif
+
+
#endif
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list