add memory-pool based string field management for structures

convert chan_sip sip_pvt and sip_registry structures to use string fields
add 'const' qualifiers to a few API calls that don't modify their input strings
add an asprintf() wrapper to astmm


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7797 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2006-01-04 21:54:09 +00:00
parent 223c0c303a
commit 80fa9689b7
8 changed files with 717 additions and 304 deletions

View File

@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2005, Digium, Inc.
* Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
@@ -38,6 +38,7 @@
#undef realloc
#undef strdup
#undef strndup
#undef asprintf
#undef vasprintf
void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
@@ -46,6 +47,7 @@ void __ast_free(void *ptr, const char *file, int lineno, const char *func);
void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func);
char *__ast_strdup(const char *s, const char *file, int lineno, const char *func);
char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func);
int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...);
int __ast_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func);
void __ast_mm_init(void);
@@ -70,6 +72,9 @@ void __ast_mm_init(void);
#define strndup(a,b) \
__ast_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
#define asprintf(a, b, c...) \
__ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c)
#define vasprintf(a,b,c) \
__ast_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__)