summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2015-02-08 12:37:10 +0000
committerStefan Bühler <stbuehler@web.de>2015-02-08 12:37:10 +0000
commit6afad87d2ed66a48cda2a7c01dbcc59023774b73 (patch)
tree9b371e94cf911630c5794f5b4ff6e3edd6439a3b /src/log.c
parent3521be8b8599ae2cc12361c8f600fc58a473de91 (diff)
downloadlighttpd-git-6afad87d2ed66a48cda2a7c01dbcc59023774b73.tar.gz
fix buffer, chunk and http_chunk API
* remove unused structs and functions (buffer_array, read_buffer) * change return type from int to void for many functions, as the return value (indicating error/success) was never checked, and the function would only fail on programming errors and not on invalid input; changed functions to use force_assert instead of returning an error. * all "len" parameters now are the real size of the memory to be read. the length of strings is given always without the terminating 0. * the "buffer" struct still counts the terminating 0 in ->used, provide buffer_string_length() to get the length of a string in a buffer. unset config "strings" have used == 0, which is used in some places to distinguish unset values from "" (empty string) values. * most buffer usages should now use it as string container. * optimise some buffer copying by "moving" data to other buffers * use (u)intmax_t for generic int-to-string functions * remove unused enum values: UNUSED_CHUNK, ENCODING_UNSET * converted BUFFER_APPEND_SLASH to inline function (no macro feature needed) * refactor: create chunkqueue_steal: moving (partial) chunks into another queue * http_chunk: added separate function to terminate chunked body instead of magic handling in http_chunk_append_mem(). http_chunk_append_* now handle empty chunks, and never terminate the chunked body. From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2975 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/log.c b/src/log.c
index 8033d170..75decfe5 100644
--- a/src/log.c
+++ b/src/log.c
@@ -152,7 +152,7 @@ int log_error_open(server *srv) {
if (srv->srvconf.errorlog_use_syslog) {
srv->errorlog_mode = ERRORLOG_SYSLOG;
- } else if (!buffer_is_empty(srv->srvconf.errorlog_file)) {
+ } else if (!buffer_string_is_empty(srv->srvconf.errorlog_file)) {
const char *logfile = srv->srvconf.errorlog_file->ptr;
if (-1 == (srv->errorlog_fd = open_logfile_or_pipe(srv, logfile))) {
@@ -170,7 +170,7 @@ int log_error_open(server *srv) {
srv->errorlog_fd = -1;
}
- if (!buffer_is_empty(srv->srvconf.breakagelog_file)) {
+ if (!buffer_string_is_empty(srv->srvconf.breakagelog_file)) {
int breakage_fd;
const char *logfile = srv->srvconf.breakagelog_file->ptr;
@@ -277,12 +277,12 @@ static void log_buffer_append_printf(buffer *out, const char *fmt, va_list ap) {
break;
case 'd': /* int */
d = va_arg(ap, int);
- buffer_append_long(out, d);
+ buffer_append_int(out, d);
buffer_append_string_len(out, CONST_STR_LEN(" "));
break;
case 'o': /* off_t */
o = va_arg(ap, off_t);
- buffer_append_off_t(out, o);
+ buffer_append_int(out, o);
buffer_append_string_len(out, CONST_STR_LEN(" "));
break;
case 'x': /* int (hex) */
@@ -301,11 +301,11 @@ static void log_buffer_append_printf(buffer *out, const char *fmt, va_list ap) {
break;
case 'D': /* int */
d = va_arg(ap, int);
- buffer_append_long(out, d);
+ buffer_append_int(out, d);
break;
case 'O': /* off_t */
o = va_arg(ap, off_t);
- buffer_append_off_t(out, o);
+ buffer_append_int(out, o);
break;
case 'X': /* int (hex) */
d = va_arg(ap, int);
@@ -339,7 +339,7 @@ static int log_buffer_prepare(buffer *b, server *srv, const char *filename, unsi
srv->last_generated_debug_ts = srv->cur_ts;
}
- buffer_copy_string_buffer(b, srv->ts_debug_str);
+ buffer_copy_buffer(b, srv->ts_debug_str);
buffer_append_string_len(b, CONST_STR_LEN(": ("));
break;
case ERRORLOG_SYSLOG:
@@ -350,7 +350,7 @@ static int log_buffer_prepare(buffer *b, server *srv, const char *filename, unsi
buffer_append_string(b, filename);
buffer_append_string_len(b, CONST_STR_LEN("."));
- buffer_append_long(b, line);
+ buffer_append_int(b, line);
buffer_append_string_len(b, CONST_STR_LEN(") "));
return 0;