[Asterisk-cvs] asterisk/include/asterisk utils.h,1.29,1.30

kpfleming at lists.digium.com kpfleming at lists.digium.com
Sun May 15 18:27:38 CDT 2005


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv18787/include/asterisk

Modified Files:
	utils.h 
Log Message:
add ast_build_string library function (from bug #3644)


Index: utils.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/utils.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- utils.h	2 May 2005 00:27:54 -0000	1.29
+++ utils.h	15 May 2005 22:33:02 -0000	1.30
@@ -185,6 +185,7 @@
   \param dst The destination buffer.
   \param src The source string
   \param size The size of the destination buffer
+  \return Nothing.
 
   This is similar to \a strncpy, with two important differences:
     - the destination buffer will \b always be null-terminated
@@ -193,8 +194,20 @@
   not leave the destination buffer unterminated. There is no need to pass an artificially
   reduced buffer size to this function (unlike \a strncpy), and the buffer does not need
   to be initialized to zeroes prior to calling this function.
-  No return value.
 */
 void ast_copy_string(char *dst, const char *src, size_t size);
 
+/*!
+  \brief Build a string in a buffer, designed to be called repeatedly
+  
+  This is a wrapper for snprintf, that properly handles the buffer pointer
+  and buffer space available.
+
+  \return 0 on success, non-zero on failure.
+  \param buffer current position in buffer to place string into (will be updated on return)
+  \param space remaining space in buffer (will be updated on return)
+  \param fmt printf-style format string
+*/
+int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+
 #endif /* _ASTERISK_UTILS_H */




More information about the svn-commits mailing list