File: 0007-Add-missing-_CI_ASSERT-macro-for-pcre2-patch.patch

package info (click to toggle)
c-icap 1%3A0.5.10-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,804 kB
  • sloc: ansic: 27,757; sh: 4,450; makefile: 252; perl: 95; awk: 10
file content (44 lines) | stat: -rw-r--r-- 1,456 bytes parent folder | download | duplicates (2)
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
From: Boyuan Yang <byang@debian.org>
Date: Sat, 29 Jul 2023 19:34:51 -0400
Subject: Add missing _CI_ASSERT macro for pcre2 patch

---
 debug.c         | 10 ++++++++++
 include/debug.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/debug.c b/debug.c
index 8a3bf6d..4f34a87 100644
--- a/debug.c
+++ b/debug.c
@@ -47,6 +47,16 @@ void __ldebug_printf(int i, const char *format, ...)
 }
 #endif
 
+void ci_debug_abort(const char *file, int line, const char *function, const char *mesg)
+{
+    ci_debug_printf(1, "Abort at %s, %d, %s: \'%s\'\n", file, line, function, mesg);
+    fflush(stderr);
+    fflush(stdout);
+    abort();
+}
+
+void (*__ci_debug_abort)(const char *file, int line, const char *function, const char *mesg) = ci_debug_abort;
+
 /*
 void debug_print_request(ci_request_t *req){
      int i,j;
diff --git a/include/debug.h b/include/debug.h
index 9373ec9..990cce7 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -44,6 +44,9 @@ CI_DECLARE_DATA extern void (*__log_error)(void *req, const char *format,... );
 #define ci_debug_printf(i, args...) if(i<=CI_DEBUG_LEVEL){ if(__log_error) (*__log_error)(NULL,args); if(CI_DEBUG_STDOUT) printf(args);}
 #endif
 
+CI_DECLARE_DATA extern void (*__ci_debug_abort)(const char *file, int line, const char *function, const char *mesg);
+#define _CI_ASSERT(expression) {if (!(expression)) (*__ci_debug_abort)(__FILE__, __LINE__, __func__, #expression);}
+
 #ifdef __cplusplus
 }
 #endif