mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Cosmetics.
This commit is contained in:
parent
ec246e2a51
commit
7c65160849
20
darkhttpd.c
20
darkhttpd.c
@ -419,35 +419,27 @@ static struct apbuf *make_apbuf(void)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Append s (of length len) to buf. */
|
||||||
|
static void appendl(struct apbuf *buf, const char *s, const size_t len) {
|
||||||
static void appendl(struct apbuf *buf, const char *s, const size_t len)
|
if (buf->pool < buf->length + len) {
|
||||||
{
|
|
||||||
if (buf->pool < buf->length + len)
|
|
||||||
{
|
|
||||||
/* pool has dried up */
|
/* pool has dried up */
|
||||||
while (buf->pool < buf->length + len) buf->pool += APBUF_GROW;
|
while (buf->pool < buf->length + len)
|
||||||
|
buf->pool += APBUF_GROW;
|
||||||
buf->str = xrealloc(buf->str, buf->pool);
|
buf->str = xrealloc(buf->str, buf->pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buf->str + buf->length, s, len);
|
memcpy(buf->str + buf->length, s, len);
|
||||||
buf->length += len;
|
buf->length += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define append(buf, s) appendl(buf, s, \
|
#define append(buf, s) appendl(buf, s, \
|
||||||
(__builtin_constant_p(s) ? sizeof(s)-1 : strlen(s)) )
|
(__builtin_constant_p(s) ? sizeof(s)-1 : strlen(s)) )
|
||||||
#else
|
#else
|
||||||
static void append(struct apbuf *buf, const char *s)
|
static void append(struct apbuf *buf, const char *s) {
|
||||||
{
|
|
||||||
appendl(buf, s, strlen(s));
|
appendl(buf, s, strlen(s));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void appendf(struct apbuf *buf, const char *format, ...)
|
static void appendf(struct apbuf *buf, const char *format, ...)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
Loading…
Reference in New Issue
Block a user