src/common.(c|h) : Add function append_snprintf().

This commit is contained in:
Erik de Castro Lopo 2009-06-30 22:01:03 +10:00
parent 1028c308b2
commit 8d33a8a530
2 changed files with 17 additions and 0 deletions

View File

@ -1314,6 +1314,21 @@ psf_rand_int32 (void)
return value ;
} /* psf_rand_int32 */
void
append_snprintf (char * dest, size_t maxlen, const char * fmt, ...)
{ size_t len = strlen (dest) ;
if (len < maxlen)
{ va_list ap ;
va_start (ap, fmt) ;
vsnprintf (dest + len, maxlen - len, fmt, ap) ;
va_end (ap) ;
} ;
return ;
} /* append_snprintf */
/*==============================================================================
*/

View File

@ -617,6 +617,8 @@ void psf_log_SF_INFO (SF_PRIVATE *psf) ;
int32_t psf_rand_int32 (void) ;
void append_snprintf (char * dest, size_t maxlen, const char * fmt, ...) ;
/* Functions used when writing file headers. */
int psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) ;