make module cache just about everything, but never return items
[httpd-crcsyncproxy.git] / crccache / ap_wrapper.c
blob397dbf645fff5b0a67d5432c02c47b2c4c0c4630
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);
25 void ap_log_hex(const char *file, int line, int level, apr_status_t status, const server_rec *s, unsigned char *buf, size_t len)
27 size_t cnt;
28 for (cnt=0; cnt < len; cnt += 32)
30 size_t cnt2;
31 char hexbuf[3*32+1];
32 for (cnt2=cnt; cnt2 != cnt+32 && cnt2 != len; cnt2++)
34 sprintf(hexbuf+3*(cnt2-cnt), "%02x.", buf[cnt2]);
36 ap_log_error(file, line, level, status, s, "%s", hexbuf);