diff src/c/cgi.c @ 1997:c93fbd139732

Define uw_loggers structure, allow FFI code to access it
author Sergey Mironov <grrwlf@gmail.com>
date Wed, 26 Feb 2014 08:21:52 +0000
parents 9f3597979e98
children
line wrap: on
line diff
--- a/src/c/cgi.c	Sun Apr 13 21:36:44 2014 -0400
+++ b/src/c/cgi.c	Wed Feb 26 08:21:52 2014 +0000
@@ -60,8 +60,10 @@
 static void log_debug(void *data, const char *fmt, ...) {
 }
 
+static uw_loggers ls = {NULL, log_error, log_debug};
+
 int main(int argc, char *argv[]) {
-  uw_context ctx = uw_request_new_context(0, &uw_application, NULL, log_error, log_debug);
+  uw_context ctx = uw_request_new_context(0, &uw_application, &ls);
   uw_request_context rc = uw_new_request_context();
   request_result rr;
   char *method = getenv("REQUEST_METHOD"),
@@ -108,7 +110,7 @@
   uw_set_on_success("");
   uw_set_headers(ctx, get_header, NULL);
   uw_set_env(ctx, get_env, NULL);
-  uw_request_init(&uw_application, NULL, log_error, log_debug);
+  uw_request_init(&uw_application, &ls);
 
   body[body_pos] = 0;
   rr = uw_request(rc, ctx, method, path, query_string, body, body_pos,