diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-13 08:36:35 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-13 08:36:35 +0000 |
commit | a41b34a63c52608e7e5c8e6aced613815461f4c2 (patch) | |
tree | 0559c99680217b78c0bda37a131b5f09794f43c6 /utils | |
parent | b298a3aa9b396c4055bf75104b4fb89212c44d4a (diff) |
Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@163991 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils')
-rw-r--r-- | utils/Makefile | 13 | ||||
-rw-r--r-- | utils/check_expr.c | 51 | ||||
-rw-r--r-- | utils/hashtest.c | 5 | ||||
-rw-r--r-- | utils/hashtest2.c | 5 | ||||
-rw-r--r-- | utils/refcounter.c | 5 |
5 files changed, 24 insertions, 55 deletions
diff --git a/utils/Makefile b/utils/Makefile index 3a280dcad..a9067802c 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -77,7 +77,7 @@ clean: rm -f *.s *.i rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c pval.c hashtab.c rm -f aelparse.c aelbison.c conf2ael - rm -f utils.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter + rm -f utils.c strings.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter md5.c: $(ASTTOPDIR)/main/md5.c $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@" @@ -149,6 +149,11 @@ utils.c: $(ASTTOPDIR)/main/utils.c $(CMD_PREFIX) cp "$<" "$@" utils.o: ASTCFLAGS+=-DSTANDALONE +strings.c: $(ASTTOPDIR)/main/strings.c + $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@" + $(CMD_PREFIX) cp "$<" "$@" +strings.o: ASTCFLAGS+=-DSTANDALONE + sha1.c: $(ASTTOPDIR)/main/sha1.c $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@" $(CMD_PREFIX) cp "$<" "$@" @@ -160,12 +165,12 @@ threadstorage.c: $(ASTTOPDIR)/main/threadstorage.c threadstorage.o: ASTCFLAGS+=-DSTANDALONE hashtest2.o: ASTCFLAGS+=-O0 -DSTANDALONE -hashtest2: hashtest2.o md5.o utils.o astobj2.o sha1.o strcompat.o threadstorage.o clicompat.o +hashtest2: hashtest2.o md5.o utils.o strings.o astobj2.o sha1.o strcompat.o threadstorage.o clicompat.o -hashtest: hashtest.o md5.o hashtab.o utils.o sha1.o strcompat.o threadstorage.o clicompat.o +hashtest: hashtest.o md5.o hashtab.o utils.o strings.o sha1.o strcompat.o threadstorage.o clicompat.o hashtest.o: ASTCFLAGS+=-O0 -DSTANDALONE -refcounter: refcounter.o md5.o hashtab.o utils.o sha1.o strcompat.o threadstorage.o clicompat.o +refcounter: refcounter.o md5.o hashtab.o utils.o strings.o sha1.o strcompat.o threadstorage.o clicompat.o refcounter.o: ASTCFLAGS+=-O0 -DSTANDALONE extconf.o: extconf.c diff --git a/utils/check_expr.c b/utils/check_expr.c index ab1cee19a..1d3fcfd0e 100644 --- a/utils/check_expr.c +++ b/utils/check_expr.c @@ -27,57 +27,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define AST_API_MODULE 1 #include "asterisk/lock.h" -#include "asterisk/strings.h" - -/* I included this from utils.c, so as not to have everything in that .c - file included */ -/*! - * core handler for dynamic strings. - * This is not meant to be called directly, but rather through the - * various wrapper macros - * ast_str_set(...) - * ast_str_append(...) - * ast_str_set_va(...) - * ast_str_append_va(...) - */ -int __attribute__((format(printf, 4, 0))) __ast_str_helper(struct ast_str **buf, size_t max_len, - int append, const char *fmt, va_list ap) -{ - int res, need; - int offset = (append && (*buf)->len) ? (*buf)->used : 0; - - if (max_len < 0) - max_len = (*buf)->len; /* don't exceed the allocated space */ - /* - * Ask vsnprintf how much space we need. Remember that vsnprintf - * does not count the final '\0' so we must add 1. - */ - res = vsnprintf((*buf)->str + offset, (*buf)->len - offset, fmt, ap); - - need = res + offset + 1; - /* - * If there is not enough space and we are below the max length, - * reallocate the buffer and return a message telling to retry. - */ - if (need > (*buf)->len && (max_len == 0 || (*buf)->len < max_len) ) { - if (max_len && max_len < need) /* truncate as needed */ - need = max_len; - else if (max_len == 0) /* if unbounded, give more room for next time */ - need += 16 + need/4; - if (ast_str_make_space(buf, need)) { - return AST_DYNSTR_BUILD_FAILED; - } - (*buf)->str[offset] = '\0'; /* Truncate the partial write. */ - - /* va_end() and va_start() must be done before calling - * vsnprintf() again. */ - return AST_DYNSTR_BUILD_RETRY; - } - /* update space used, keep in mind the truncation */ - (*buf)->used = (res + offset > (*buf)->len) ? (*buf)->len : res + offset; - - return res; -} #ifndef DEBUG_THREADS enum ast_lock_type { AST_MUTEX, diff --git a/utils/hashtest.c b/utils/hashtest.c index 7ff7a55b2..16c5e1d9b 100644 --- a/utils/hashtest.c +++ b/utils/hashtest.c @@ -50,6 +50,11 @@ int64_t ast_mark(int prof_id, int x) } #endif +void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used); +void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used) +{ +} + struct ht_element { char *key; diff --git a/utils/hashtest2.c b/utils/hashtest2.c index 3b0c62699..a9fdf661b 100644 --- a/utils/hashtest2.c +++ b/utils/hashtest2.c @@ -59,6 +59,11 @@ struct ht_element char *val; }; +char *pbx_substitute_variables_helper_full(struct ast_channel *chan, struct varshead *head, const char *cp1, char *cp2, int maxlen, size_t *used); +char *pbx_substitute_variables_helper_full(struct ast_channel *chan, struct varshead *head, const char *cp1, char *cp2, int maxlen, size_t *used) +{ + return NULL; +} static int hash_string(const void *obj, const int flags) { diff --git a/utils/refcounter.c b/utils/refcounter.c index 4712c26b6..ddd5055d0 100644 --- a/utils/refcounter.c +++ b/utils/refcounter.c @@ -69,6 +69,11 @@ struct rc_obj /* short for refcounted object */ struct rc_hist *last; }; +void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used); +void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used) +{ +} + static unsigned int hashtab_hash_rc(const void *obj) { const struct rc_obj *rc = obj; |