| 1 | /* |
| 2 | Copyright(C) 2015-2018 Brazil |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #include "grn_report.h"cxx . . $ `<file>/lib/grn_report.h`/ |
| 20 | |
| 21 | const grn_log_levelcxx . . $ grn_log_level# GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL. = GRN_LOG_INFOcxx . . $ GRN_LOG_INFO.; |
| 22 | |
| 23 | void |
| 24 | grn_report_indexcxx . . $ grn_report_index(a946cb14e70570c4).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 25 | const char *action, |
| 26 | const char *tag, |
| 27 | grn_objcxx . . $ grn_obj# *index) |
| 28 | { |
| 29 | char index_name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 30 | int index_name_size; |
| 31 | |
| 32 | if (!grn_logger_passcxx . . $ grn_logger_pass(188766080ec9c0f2).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | index_name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, index, index_name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 37 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 38 | "%s[index]%s <%.*s>", |
| 39 | action, tag, index_name_size, index_name); |
| 40 | } |
| 41 | |
| 42 | void |
| 43 | grn_report_index_not_usedcxx . . $ grn_report_index_not_used(a1a7a0c1ad554d57).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 44 | const char *action, |
| 45 | const char *tag, |
| 46 | grn_objcxx . . $ grn_obj# *index, |
| 47 | const char *reason) |
| 48 | { |
| 49 | char index_name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 50 | int index_name_size; |
| 51 | |
| 52 | if (!grn_logger_passcxx . . $ grn_logger_pass(188766080ec9c0f2).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | index_name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, index, index_name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 57 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 58 | "%s[index-not-used]%s <%.*s>: %s", |
| 59 | action, tag, index_name_size, index_name, reason); |
| 60 | } |
| 61 | |
| 62 | void |
| 63 | grn_report_tablecxx . . $ grn_report_table(a946cb14e70570c4).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 64 | const char *action, |
| 65 | const char *tag, |
| 66 | grn_objcxx . . $ grn_obj# *table) |
| 67 | { |
| 68 | grn_objcxx . . $ grn_obj# description; |
| 69 | grn_objcxx . . $ grn_obj# *target; |
| 70 | grn_objcxx . . $ grn_obj# *previous_target = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 71 | |
| 72 | if (!grn_logger_passcxx . . $ grn_logger_pass(188766080ec9c0f2).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&description, 0); |
| 77 | for (target = table; |
| 78 | target; |
| 79 | previous_target = target, target = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.)) { |
| 80 | char name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 81 | int name_size; |
| 82 | |
| 83 | name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, target, name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 84 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&description) > 0) { |
| 85 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, " -> "); |
| 86 | } |
| 87 | if (name_size == 0) { |
| 88 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, "(temporary)"); |
| 89 | } else { |
| 90 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, "<"); |
| 91 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &description, name, name_size); |
| 92 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, ">"); |
| 93 | } |
| 94 | if (previous_target && previous_target != table) { |
| 95 | grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, previous_target); |
| 96 | } |
| 97 | } |
| 98 | if (previous_target && previous_target != table) { |
| 99 | grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, previous_target); |
| 100 | } |
| 101 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 102 | "%s[table]%s %.*s", |
| 103 | action, tag, |
| 104 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&description), |
| 105 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&description)); |
| 106 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &description); |
| 107 | } |
| 108 | |
| 109 | void |
| 110 | grn_report_columncxx . . $ grn_report_column(a946cb14e70570c4).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 111 | const char *action, |
| 112 | const char *tag, |
| 113 | grn_objcxx . . $ grn_obj# *column) |
| 114 | { |
| 115 | grn_objcxx . . $ grn_obj# description; |
| 116 | grn_objcxx . . $ grn_obj# *target; |
| 117 | grn_objcxx . . $ grn_obj# *previous_target = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 118 | |
| 119 | if (!grn_logger_passcxx . . $ grn_logger_pass(188766080ec9c0f2).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&description, 0); |
| 124 | for (target = column; |
| 125 | target; |
| 126 | previous_target = target, target = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, target))) { |
| 127 | char name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 128 | int name_size; |
| 129 | |
| 130 | name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, target, name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 131 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&description) > 0) { |
| 132 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, " -> "); |
| 133 | } |
| 134 | if (name_size == 0) { |
| 135 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, "(temporary)"); |
| 136 | } else { |
| 137 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, "<"); |
| 138 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &description, name, name_size); |
| 139 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, ">"); |
| 140 | } |
| 141 | if (previous_target && previous_target != column) { |
| 142 | grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, previous_target); |
| 143 | } |
| 144 | } |
| 145 | if (previous_target && previous_target != column) { |
| 146 | grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, previous_target); |
| 147 | } |
| 148 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 149 | "%s[column]%s %.*s", |
| 150 | action, tag, |
| 151 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&description), |
| 152 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&description)); |
| 153 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &description); |
| 154 | } |
| 155 | |
| 156 | void |
| 157 | grn_report_accessorcxx . . $ grn_report_accessor(a946cb14e70570c4).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 158 | const char *action, |
| 159 | const char *tag, |
| 160 | grn_objcxx . . $ grn_obj# *accessor) |
| 161 | { |
| 162 | grn_objcxx . . $ grn_obj# description; |
| 163 | grn_objcxx . . $ grn_obj# *range; |
| 164 | |
| 165 | if (!grn_logger_passcxx . . $ grn_logger_pass(188766080ec9c0f2).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 166 | return; |
| 167 | } |
| 168 | |
| 169 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&description, 0); |
| 170 | grn_accessor_namecxx . . $ grn_accessor_name(d825b4ed5bf12304).(ctx, accessor, &description); |
| 171 | range = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, accessor)); |
| 172 | if (range) { |
| 173 | char name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 174 | int name_size; |
| 175 | |
| 176 | name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, range, name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 177 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, " -> "); |
| 178 | if (name_size == 0) { |
| 179 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, "(temporary)"); |
| 180 | } else { |
| 181 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, "<"); |
| 182 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &description, name, name_size); |
| 183 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &description, ">"); |
| 184 | } |
| 185 | grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, range); |
| 186 | } |
| 187 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 188 | "%s[accessor]%s %.*s", |
| 189 | action, tag, |
| 190 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&description), |
| 191 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&description)); |
| 192 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &description); |
| 193 | } |