mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 02:39:44 +00:00
Change return type of strbuf_sprintf()
This commit is contained in:
parent
c9131f43a2
commit
00037cf803
10
strbuf.c
10
strbuf.c
@ -101,16 +101,16 @@ strbuf strbuf_putc(strbuf sb, char ch)
|
||||
return sb;
|
||||
}
|
||||
|
||||
int strbuf_sprintf(strbuf sb, const char *fmt, ...)
|
||||
strbuf strbuf_sprintf(strbuf sb, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
int n = strbuf_vsprintf(sb, fmt, ap);
|
||||
strbuf_vsprintf(sb, fmt, ap);
|
||||
va_end(ap);
|
||||
return n;
|
||||
return sb;
|
||||
}
|
||||
|
||||
int strbuf_vsprintf(strbuf sb, const char *fmt, va_list ap)
|
||||
strbuf strbuf_vsprintf(strbuf sb, const char *fmt, va_list ap)
|
||||
{
|
||||
int n;
|
||||
if (sb->start && !sb->end) {
|
||||
@ -126,7 +126,7 @@ int strbuf_vsprintf(strbuf sb, const char *fmt, va_list ap)
|
||||
}
|
||||
if (n != -1)
|
||||
sb->current += n;
|
||||
return n;
|
||||
return sb;
|
||||
}
|
||||
|
||||
char *strbuf_substr(const_strbuf sb, int offset)
|
||||
|
6
strbuf.h
6
strbuf.h
@ -353,7 +353,7 @@ strbuf strbuf_putc(strbuf sb, char ch);
|
||||
|
||||
|
||||
/** Append the results of sprintf(fmt,...) to the string buffer, truncating if
|
||||
* necessary to avoid buffer overrun. Return sprintf()'s return value.
|
||||
* necessary to avoid buffer overrun. Return a pointer to the strbuf.
|
||||
*
|
||||
* This is equivalent to char tmp[...]; sprintf(tmp, fmt, ...); strbuf_puts(tmp);
|
||||
* assuming that tmp[] is large enough to contain the entire string produced by
|
||||
@ -361,8 +361,8 @@ strbuf strbuf_putc(strbuf sb, char ch);
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
int strbuf_sprintf(strbuf sb, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int strbuf_vsprintf(strbuf sb, const char *fmt, va_list ap);
|
||||
strbuf strbuf_sprintf(strbuf sb, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
strbuf strbuf_vsprintf(strbuf sb, const char *fmt, va_list ap);
|
||||
|
||||
|
||||
/** Return a pointer to the current nul-terminated string in the strbuf.
|
||||
|
Loading…
Reference in New Issue
Block a user