Solve 32-bit versus 64-bit compatibility issues
[httpd-crcsyncproxy.git] / crccache / ap_wrapper.c
blobcd7539cf60016d3eecc68bee3820b68a62bf1d62
1 #include <stdarg.h>
3 #include "httpd.h"
4 #include "http_log.h"
6 /**
7 * ap_log_error does not support %zd or %zu conversion for type_t arguments
8 * So with ap_log_error one would have to specify either %d or %ld, depending on the
9 * platform (32-bit or 64-bit). This violates the whole purpose of type_t, which
10 * was introduced in C exactly to provide cross-platform compatibility...
11 * This wrapper function supports %zd and %zu conversion parameters.
12 * Note that it truncates the logged message to 1000 bytes, so don't use it to log messages that might
13 * be longer
15 void ap_log_error_wrapper(const char *file, int line, int level, apr_status_t status, const server_rec *s,
16 const char *fmt, ...)
18 char msg[1000];
19 va_list ap;
20 va_start(ap, fmt);
21 vsnprintf(msg, sizeof(msg), fmt, ap);
22 ap_log_error(file, line, level, status, s, "%s", msg);