summaryrefslogtreecommitdiff
path: root/main/strcompat.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2018-02-19 19:55:50 -0600
committerRichard Mudgett <rmudgett@digium.com>2018-03-01 13:13:55 -0600
commitc711e4076a6913e18e27a694bcb3fb721822fb58 (patch)
tree57d414b30a6ac76408ea8831c071ce54ffc428d4 /main/strcompat.c
parente58ae393b1f83981178c7ddedf4cfb40e6ca5f31 (diff)
core: Remove ABI effects of MALLOC_DEBUG.
This allows asterisk to be compiled with MALLOC_DEBUG to load modules built without MALLOC_DEBUG. Now pre-compiled third-party modules will still work regardless of MALLOC_DEBUG being enabled or not. Change-Id: Ic07ad80b2c2df894db984cf27b16a69383ce0e10
Diffstat (limited to 'main/strcompat.c')
-rw-r--r--main/strcompat.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/main/strcompat.c b/main/strcompat.c
index c3b4ff180..0034c2177 100644
--- a/main/strcompat.c
+++ b/main/strcompat.c
@@ -25,6 +25,7 @@
<support_level>core</support_level>
***/
+#define ASTMM_LIBC ASTMM_IGNORE
#include "asterisk.h"
#include <ctype.h>
@@ -139,7 +140,7 @@ size_t strnlen(const char *s, size_t n)
}
#endif /* !HAVE_STRNLEN */
-#if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
+#if !defined(HAVE_STRNDUP)
char *strndup(const char *s, size_t n)
{
size_t len = strnlen(s, n);
@@ -151,9 +152,9 @@ char *strndup(const char *s, size_t n)
new[len] = '\0';
return memcpy(new, s, len);
}
-#endif /* !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC) */
+#endif /* !defined(HAVE_STRNDUP) */
-#if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC)
+#if !defined(HAVE_VASPRINTF)
int vasprintf(char **strp, const char *fmt, va_list ap)
{
int size;
@@ -171,7 +172,7 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
return size;
}
-#endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
+#endif /* !defined(HAVE_VASPRINTF) */
#ifndef HAVE_TIMERSUB
void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff)
@@ -205,7 +206,7 @@ void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tv
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
+#if !defined(HAVE_ASPRINTF)
int asprintf(char **str, const char *fmt, ...)
{
va_list ap;
@@ -218,7 +219,7 @@ int asprintf(char **str, const char *fmt, ...)
return ret;
}
-#endif /* !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
+#endif /* !defined(HAVE_ASPRINTF) */
#ifndef HAVE_STRTOQ
#ifndef LONG_MIN