[asterisk-commits] kpfleming: branch jpeeler/bug13593-2 r180798 - in /team/jpeeler/bug13593-2: i...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 10 06:49:28 CDT 2009
Author: kpfleming
Date: Tue Mar 10 06:49:25 2009
New Revision: 180798
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=180798
Log:
disable astmm.h from doing anything when STANDALONE is defined, which is used by the tools in the utils/ directory that use parts of Asterisk header files in hackish ways; also ensure that utils/extconf.c and utils/conf2ael.c are compiled with STANDALONE defined
Modified:
team/jpeeler/bug13593-2/include/asterisk/astmm.h
team/jpeeler/bug13593-2/utils/Makefile
team/jpeeler/bug13593-2/utils/extconf.c
Modified: team/jpeeler/bug13593-2/include/asterisk/astmm.h
URL: http://svn.digium.com/svn-view/asterisk/team/jpeeler/bug13593-2/include/asterisk/astmm.h?view=diff&rev=180798&r1=180797&r2=180798
==============================================================================
--- team/jpeeler/bug13593-2/include/asterisk/astmm.h (original)
+++ team/jpeeler/bug13593-2/include/asterisk/astmm.h Tue Mar 10 06:49:25 2009
@@ -27,6 +27,8 @@
#ifndef _ASTERISK_ASTMM_H
#define _ASTERISK_ASTMM_H
+
+#ifndef STANDALONE
#define __AST_DEBUG_MALLOC
@@ -115,6 +117,8 @@
#define ast_vasprintf(a,b,c) \
__ast_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+#endif /* !STANDALONE */
+
#else
#error "NEVER INCLUDE astmm.h DIRECTLY!!"
#endif /* _ASTERISK_ASTMM_H */
Modified: team/jpeeler/bug13593-2/utils/Makefile
URL: http://svn.digium.com/svn-view/asterisk/team/jpeeler/bug13593-2/utils/Makefile?view=diff&rev=180798&r1=180797&r2=180798
==============================================================================
--- team/jpeeler/bug13593-2/utils/Makefile (original)
+++ team/jpeeler/bug13593-2/utils/Makefile Tue Mar 10 06:49:25 2009
@@ -188,6 +188,9 @@
refcounter.o: ASTCFLAGS+=-O0 -DSTANDALONE
extconf.o: extconf.c
+extconf.o: ASTCFLAGS+=-DSTANDALONE
+
+conf2ael.o: ASTCFLAGS+=-DSTANDALONE
conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o hashtab.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o
Modified: team/jpeeler/bug13593-2/utils/extconf.c
URL: http://svn.digium.com/svn-view/asterisk/team/jpeeler/bug13593-2/utils/extconf.c?view=diff&rev=180798&r1=180797&r2=180798
==============================================================================
--- team/jpeeler/bug13593-2/utils/extconf.c (original)
+++ team/jpeeler/bug13593-2/utils/extconf.c Tue Mar 10 06:49:25 2009
@@ -891,10 +891,10 @@
/* from utils.h */
#define ast_free free
+#define ast_free_ptr free
#define MALLOC_FAILURE_MSG \
ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file);
-#ifndef __AST_DEBUG_MALLOC
/*!
* \brief A wrapper for malloc()
@@ -928,97 +928,6 @@
#define ast_vasprintf(ret, fmt, ap) \
_ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
-#else
-
-/* If astmm is in use, let it handle these. Otherwise, it will report that
- all allocations are coming from this header file */
-
-#undef __ast_calloc
-#undef calloc
-#undef ast_calloc
-
-#define ast_malloc(a) malloc(a)
-#define ast_calloc(a,b) calloc(a,b)
-#define ast_realloc(a,b) realloc(a,b)
-#define ast_strdup(a) strdup(a)
-#define ast_strndup(a,b) strndup(a,b)
-#define ast_asprintf(a,b,...) asprintf(a,b,__VA_ARGS__)
-#define ast_vasprintf(a,b,c) vasprintf(a,b,c)
-
-void * attribute_malloc __ast_malloc(size_t len, const char *file, int lineno, const char *func)
-{
- void *p;
-
- if (!(p = malloc(len)))
- MALLOC_FAILURE_MSG;
-
- return p;
-}
-
-void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func)
-{
- void *p;
-
- if (!(p = calloc(num, len)))
- MALLOC_FAILURE_MSG;
-
- return p;
-}
-
-void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func);
-
-void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func)
-{
- void *p;
-
- if (!(p = calloc(num, len)))
- MALLOC_FAILURE_MSG;
-
- return p;
-}
-
-void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func)
-{
- void *newp;
-
- if (!(newp = realloc(p, len)))
- MALLOC_FAILURE_MSG;
-
- return newp;
-}
-
-char * attribute_malloc __ast_strdup(const char *str, const char *file, int lineno, const char *func)
-{
- char *newstr = NULL;
-
- if (str) {
- if (!(newstr = strdup(str)))
- MALLOC_FAILURE_MSG;
- }
-
- return newstr;
-}
-
-char * attribute_malloc __ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func)
-{
- char *newstr = NULL;
-
- if (str) {
- if (!(newstr = strndup(str, len)))
- MALLOC_FAILURE_MSG;
- }
-
- return newstr;
-}
-
-void __ast_free(void *ptr, const char *file, int lineno, const char *func)
-{
-#undef free
- free(ptr);
-}
-
-#endif /* AST_DEBUG_MALLOC */
-
static unsigned int __unsigned_int_flags_dummy;
@@ -1043,8 +952,6 @@
} while (0)
-
-#ifndef __AST_DEBUG_MALLOC
#define MALLOC_FAILURE_MSG \
ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file);
@@ -1238,20 +1145,6 @@
return res;
}
)
-
-#else
-
-/* If astmm is in use, let it handle these. Otherwise, it will report that
- all allocations are coming from this header file */
-
-#define ast_malloc(a) malloc(a)
-#define ast_calloc(a,b) calloc(a,b)
-#define ast_realloc(a,b) realloc(a,b)
-#define ast_strdup(a) strdup(a)
-#define ast_strndup(a,b) strndup(a,b)
-#define ast_vasprintf(a,b,c) vasprintf(a,b,c)
-
-#endif /* AST_DEBUG_MALLOC */
#if !defined(ast_strdupa) && defined(__GNUC__)
/*!
More information about the asterisk-commits
mailing list