summaryrefslogtreecommitdiff
path: root/ngx_stream_lua-0.0.16/src/ddebug.h
blob: 6ee0cb5a703a1030b9f6067ce318b3ffeae762b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
 * !!! DO NOT EDIT DIRECTLY !!!
 * This file was automatically generated from the following template:
 *
 * src/subsys/ddebug.h.tt2
 */


/*
 * Copyright (C) Yichun Zhang (agentzh)
 */


#ifndef _DDEBUG_H_INCLUDED_
#define _DDEBUG_H_INCLUDED_


#include <ngx_config.h>
#include <nginx.h>
#include <ngx_core.h>


#if defined(DDEBUG) && (DDEBUG)

#   if (NGX_HAVE_VARIADIC_MACROS)

#       define dd(...) fprintf(stderr, "lua *** %s: ", __func__);            \
            fprintf(stderr, __VA_ARGS__);                                    \
            fprintf(stderr, " at %s line %d.\n", __FILE__, __LINE__)

#   else

#include <stdarg.h>
#include <stdio.h>

#include <stdarg.h>

static ngx_inline void
dd(const char *fmt, ...) {
}

#    endif

#else

#   if (NGX_HAVE_VARIADIC_MACROS)

#       define dd(...)

#   else

#include <stdarg.h>

static ngx_inline void
dd(const char *fmt, ...) {
}

#   endif

#endif

#if defined(DDEBUG) && (DDEBUG)

#define dd_check_read_event_handler(r)                                       \
    dd("r->read_event_handler = %s",                                         \
       r->read_event_handler == ngx_http_block_reading ?                     \
       "ngx_http_block_reading" :                                            \
       r->read_event_handler == ngx_http_test_reading ?                      \
       "ngx_http_test_reading" :                                             \
       r->read_event_handler == ngx_http_request_empty_handler ?             \
       "ngx_http_request_empty_handler" : "UNKNOWN")

#define dd_check_write_event_handler(r)                                      \
    dd("r->write_event_handler = %s",                                        \
       r->write_event_handler == ngx_http_handler ?                          \
       "ngx_http_handler" :                                                  \
       r->write_event_handler == ngx_http_core_run_phases ?                  \
       "ngx_http_core_run_phases" :                                          \
       r->write_event_handler == ngx_http_request_empty_handler ?            \
       "ngx_http_request_empty_handler" : "UNKNOWN")

#else

#define dd_check_read_event_handler(r)
#define dd_check_write_event_handler(r)

#endif


#endif /* _DDEBUG_H_INCLUDED_ */

/* vi:set ft=c ts=4 sw=4 et fdm=marker: */