| 37 | } |
| 38 | |
| 39 | void 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; |
no test coverage detected
searching dependent graphs…