ngx_vslprintf(), ngx_slprintf()

This commit is contained in:
Igor Sysoev 2009-04-27 12:51:33 +00:00
parent 8ec9a72295
commit 4e1fe03e03
2 changed files with 23 additions and 11 deletions

View File

@ -99,7 +99,7 @@ ngx_sprintf(u_char *buf, const char *fmt, ...)
va_list args;
va_start(args, fmt);
p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args);
p = ngx_vslprintf(buf, (void *) -1, fmt, args);
va_end(args);
return p;
@ -113,7 +113,21 @@ ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
va_list args;
va_start(args, fmt);
p = ngx_vsnprintf(buf, max, fmt, args);
p = ngx_vslprintf(buf, buf + max, fmt, args);
va_end(args);
return p;
}
u_char * ngx_cdecl
ngx_slprintf(u_char *buf, u_char *last, const char *fmt, ...)
{
u_char *p;
va_list args;
va_start(args, fmt);
p = ngx_vslprintf(buf, last, fmt, args);
va_end(args);
return p;
@ -121,9 +135,9 @@ ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args)
{
u_char *p, zero, *last;
u_char *p, zero;
int d;
float f, scale;
size_t len, slen;
@ -134,12 +148,6 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
ngx_str_t *v;
ngx_variable_value_t *vv;
if (max == 0) {
return buf;
}
last = buf + max;
while (*fmt && buf < last) {
/*

View File

@ -140,7 +140,11 @@ u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n);
u_char *ngx_pstrdup(ngx_pool_t *pool, ngx_str_t *src);
u_char * ngx_cdecl ngx_sprintf(u_char *buf, const char *fmt, ...);
u_char * ngx_cdecl ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...);
u_char *ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args);
u_char * ngx_cdecl ngx_slprintf(u_char *buf, u_char *last, const char *fmt,
...);
u_char *ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args);
#define ngx_vsnprintf(buf, max, fmt, args) \
ngx_vslprintf(buf, buf + (max), fmt, args)
ngx_int_t ngx_strcasecmp(u_char *s1, u_char *s2);
ngx_int_t ngx_strncasecmp(u_char *s1, u_char *s2, size_t n);