[asterisk-commits] russell: branch russell/ast_verbose_threadstorage r38451 - in /team/russell/a...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jul 28 13:24:00 MST 2006


Author: russell
Date: Fri Jul 28 15:24:00 2006
New Revision: 38451

URL: http://svn.digium.com/view/asterisk?rev=38451&view=rev
Log:
change the name of some of the threadstorage API calls because using the word
"build" in the context of creating a string is a bit confusing in this case
because it does not do the same thing as the existing ast_build_string()
function

Modified:
    team/russell/ast_verbose_threadstorage/cli.c
    team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h
    team/russell/ast_verbose_threadstorage/logger.c

Modified: team/russell/ast_verbose_threadstorage/cli.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/cli.c?rev=38451&r1=38450&r2=38451&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/cli.c (original)
+++ team/russell/ast_verbose_threadstorage/cli.c Fri Jul 28 15:24:00 2006
@@ -67,7 +67,7 @@
 		return;
 
 	va_start(ap, fmt);
-	res = ast_dynamic_str_threadbuild_va(&buf, 0, &ast_cli_buf, fmt, ap);
+	res = ast_dynamic_str_thread_printf_va(&buf, 0, &ast_cli_buf, fmt, ap);
 	va_end(ap);
 
 	if (res > 0)

Modified: team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h?rev=38451&r1=38450&r2=38451&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h (original)
+++ team/russell/ast_verbose_threadstorage/include/asterisk/threadstorage.h Fri Jul 28 15:24:00 2006
@@ -198,14 +198,14 @@
 )
 
 /*!
- * \brief Error codes from __ast_dynamic_str_threadbuild_va()
+ * \brief Error codes from __ast_dynamic_str_thread_printf_va()
  */
 enum {
 	/*! An error has occured and the contents of the dynamic string
 	 *  are undefined */
 	AST_DYNSTR_BUILD_FAILED = -1,
 	/*! The buffer size for the dynamic string had to be increased, and
-	 *  __ast_dynamic_str_threadbuild_va() needs to be called again after
+	 *  __ast_dynamic_str_thread_printf_va() needs to be called again after
 	 *  a va_end() and va_start().
 	 */
 	AST_DYNSTR_BUILD_RETRY = -2
@@ -244,7 +244,7 @@
  *           return;
  *      ...
  *      va_start(fmt, ap);
- *      ast_dynamic_str_threadbuild_va(&buf, 0, &my_str, fmt, ap);
+ *      ast_dynamic_str_thread_printf_va(&buf, 0, &my_str, fmt, ap);
  *      va_end(ap);
  * 
  *      printf("This is the string we just built: %s\n", buf->str);
@@ -252,19 +252,19 @@
  * }
  * \endcode
  */
-#define ast_dynamic_str_threadbuild_va(buf, max_len, ts, fmt, ap)              \
-	({                                                                     \
-		int __res;                                                     \
-		while ((__res = __ast_dynamic_str_threadbuild_va(buf, max_len, \
-			ts, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) {             \
-			va_end(ap);                                            \
-			va_start(ap, fmt);                                     \
-		}                                                              \
-		(__res);                                                       \
+#define ast_dynamic_str_thread_printf_va(buf, max_len, ts, fmt, ap)              \
+	({                                                                       \
+		int __res;                                                       \
+		while ((__res = __ast_dynamic_str_thread_printf_va(buf, max_len, \
+			ts, fmt, ap)) == AST_DYNSTR_BUILD_RETRY) {               \
+			va_end(ap);                                              \
+			va_start(ap, fmt);                                       \
+		}                                                                \
+		(__res);                                                         \
 	})
 
 AST_INLINE_API(
-int __ast_dynamic_str_threadbuild_va(struct ast_dynamic_str **buf, size_t max_len,
+int __ast_dynamic_str_thread_printf_va(struct ast_dynamic_str **buf, size_t max_len,
 	struct ast_threadstorage *ts, const char *fmt, va_list ap),
 {
 	int res;
@@ -297,14 +297,14 @@
  *         family of functions.
  */
 AST_INLINE_API(
-int ast_dynamic_str_build(struct ast_dynamic_str **buf, size_t max_len,
+int ast_dynamic_str_printf(struct ast_dynamic_str **buf, size_t max_len,
 	const char *fmt, ...),
 {
 	int res;
 	va_list ap;
 	
 	va_start(ap, fmt);
-	res = ast_dynamic_str_threadbuild_va(buf, max_len, NULL, fmt, ap);
+	res = ast_dynamic_str_thread_printf_va(buf, max_len, NULL, fmt, ap);
 	va_end(ap);
 
 	return res;
@@ -342,7 +342,7 @@
  *      if (!(buf = ast_dynamic_str_threadget(&my_str, MY_STR_INIT_SIZE)))
  *           return;
  *      ...
- *      ast_dynamic_str_threadbuild(&buf, 0, &my_str, "arg1: %d  arg2: %d\n",
+ *      ast_dynamic_str_thread_printf(&buf, 0, &my_str, "arg1: %d  arg2: %d\n",
  *           arg1, arg2);
  * 
  *      printf("This is the string we just built: %s\n", buf->str);
@@ -351,14 +351,14 @@
  * \endcode
  */
 AST_INLINE_API(
-int ast_dynamic_str_threadbuild(struct ast_dynamic_str **buf, size_t max_len, 
+int ast_dynamic_str_thread_printf(struct ast_dynamic_str **buf, size_t max_len, 
 	struct ast_threadstorage *ts, const char *fmt, ...),
 {
 	int res;
 	va_list ap;
 
 	va_start(ap, fmt);
-	res = ast_dynamic_str_threadbuild_va(buf, max_len, ts, fmt, ap);
+	res = ast_dynamic_str_thread_printf_va(buf, max_len, ts, fmt, ap);
 	va_end(ap);
 
 	return res;

Modified: team/russell/ast_verbose_threadstorage/logger.c
URL: http://svn.digium.com/view/asterisk/team/russell/ast_verbose_threadstorage/logger.c?rev=38451&r1=38450&r2=38451&view=diff
==============================================================================
--- team/russell/ast_verbose_threadstorage/logger.c (original)
+++ team/russell/ast_verbose_threadstorage/logger.c Fri Jul 28 15:24:00 2006
@@ -740,7 +740,7 @@
 				if (level != __LOG_VERBOSE) {
 					int res;
 					sprintf(linestr, "%d", line);
-					ast_dynamic_str_threadbuild(&buf, BUFSIZ, &log_buf,
+					ast_dynamic_str_thread_printf(&buf, BUFSIZ, &log_buf,
 						"[%s] %s[%ld]: %s:%s %s: ",
 						date,
 						term_color(tmp1, levels[level], colors[level], 0, sizeof(tmp1)),
@@ -752,7 +752,7 @@
 					ast_console_puts_mutable(buf->str);
 					
 					va_start(ap, fmt);
-					res = ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap);
+					res = ast_dynamic_str_thread_printf_va(&buf, BUFSIZ, &log_buf, fmt, ap);
 					va_end(ap);
 					if (res != AST_DYNSTR_BUILD_FAILED)
 						ast_console_puts_mutable(buf->str);
@@ -760,7 +760,7 @@
 			/* File channels */
 			} else if ((chan->logmask & (1 << level)) && (chan->fileptr)) {
 				int res;
-				ast_dynamic_str_threadbuild(&buf, BUFSIZ, &log_buf, 
+				ast_dynamic_str_thread_printf(&buf, BUFSIZ, &log_buf, 
 					"[%s] %s[%ld] %s: ",
 					date, levels[level], (long)GETTID(), file);
 				res = fprintf(chan->fileptr, "%s", buf->str);
@@ -776,7 +776,7 @@
 					int res;
 					/* No error message, continue printing */
 					va_start(ap, fmt);
-					ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap);
+					ast_dynamic_str_thread_printf_va(&buf, BUFSIZ, &log_buf, fmt, ap);
 					va_end(ap);
 					if (res != AST_DYNSTR_BUILD_FAILED) {
 						term_strip(buf->str, buf->str, buf->len);
@@ -794,7 +794,7 @@
 		if (level != __LOG_VERBOSE) {
 			int res;
 			va_start(ap, fmt);
-			res = ast_dynamic_str_threadbuild_va(&buf, BUFSIZ, &log_buf, fmt, ap);
+			res = ast_dynamic_str_thread_printf_va(&buf, BUFSIZ, &log_buf, fmt, ap);
 			va_end(ap);
 			if (res != AST_DYNSTR_BUILD_FAILED)
 				fputs(buf->str, stdout);
@@ -865,7 +865,7 @@
 		return;
 
 	va_start(ap, fmt);
-	res = ast_dynamic_str_threadbuild_va(&buf, 0, &verbose_buf, fmt, ap);
+	res = ast_dynamic_str_thread_printf_va(&buf, 0, &verbose_buf, fmt, ap);
 	va_end(ap);
 
 	if (res == AST_DYNSTR_BUILD_FAILED)



More information about the asterisk-commits mailing list