diff options
author | Luca Abeni <lucabe72@email.it> | 2007-07-19 06:36:02 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2007-07-19 06:36:02 +0000 |
commit | 1e7f363804cb9fbe4eb8193a5711fdfd00619776 (patch) | |
tree | cba94cac733a19f0e83180acd7ff6e2739712439 /libavutil/string.c | |
parent | 614e9b24245528c28288b0b17898b130db5aab77 (diff) | |
download | ffmpeg-1e7f363804cb9fbe4eb8193a5711fdfd00619776.tar.gz |
Implement av_strlcatf(): a strlcat which adds a printf style formatted string
Originally committed as revision 9753 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/string.c')
-rw-r--r-- | libavutil/string.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/string.c b/libavutil/string.c index 2f4de8ef50..8ee2a6b12f 100644 --- a/libavutil/string.c +++ b/libavutil/string.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <stdarg.h> +#include <stdio.h> #include <string.h> #include <ctype.h> #include "avstring.h" @@ -62,3 +64,15 @@ size_t av_strlcat(char *dst, const char *src, size_t size) return len + strlen(src); return len + av_strlcpy(dst + len, src, size - len); } + +size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) +{ + int len = strlen(dst); + va_list vl; + + va_start(vl, fmt); + len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); + va_end(vl); + + return len; +} |