MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_debug_init2

Function acl_debug_init2

lib_acl/src/stdlib/acl_debug.c:39–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void acl_debug_init2(const char *str, int max_debug_level)
40{
41 int i, level_all = -1, section, level;
42 char *buf = acl_mystrdup(str), *tmp;
43 ACL_ARGV *tokens;
44
45 tmp = acl_mystr_trim(buf);
46 if (*tmp == 0) {
47 acl_myfree(buf);
48 return;
49 }
50 tokens = acl_argv_split(tmp, ";,");
51 acl_myfree(buf);
52
53 __max_sections = max_debug_level > 100 ? max_debug_level : 100;
54
55 if (__debug_levels)
56 acl_myfree(__debug_levels);
57
58 __debug_levels = (int*) acl_mycalloc(__max_sections, sizeof(int));
59
60 for (i = 0; i < __max_sections; i++)
61 __debug_levels[i] = 0;
62
63 for (i = 0; i < tokens->argc; i++) {
64 size_t n;
65 char* ptr = tokens->argv[i];
66 ACL_ARGV* pair = acl_argv_split(ptr, ":");
67 if (pair->argc != 2) {
68 acl_argv_free(pair);
69 continue;
70 }
71
72 if (strcasecmp(pair->argv[0], "All") == 0) {
73 level_all = atoi(pair->argv[1]);
74 acl_argv_free(pair);
75 continue;
76 }
77
78 ptr = pair->argv[0];
79 n = strcspn(ptr, "->|,;.@{}[]<>#$%^&()+*!");
80 ptr[n] = 0;
81
82 section = atoi(pair->argv[0]);
83 level = atoi(pair->argv[1]);
84
85 acl_argv_free(pair);
86
87 if (section < __max_sections && section >= 0 && level >= 0)
88 __debug_levels[section] = level;
89 }
90
91 acl_argv_free(tokens);
92
93 if (level_all >= 0) {
94 for (i = 0; i < __max_sections; i++) {
95 if (__debug_levels[i] < level_all)
96 __debug_levels[i] = level_all;

Callers 9

open_service_logFunction · 0.85
open_service_logFunction · 0.85
open_service_logFunction · 0.85
acl_debug_initFunction · 0.85
open_service_logFunction · 0.85
open_service_logFunction · 0.85
udp_server_open_logFunction · 0.85
trigger_server_open_logFunction · 0.85
single_server_open_logFunction · 0.85

Calls 2

acl_argv_splitFunction · 0.85
acl_argv_freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…