| 990 | }; |
| 991 | |
| 992 | void process_events(cdb2_hndl_tp *db, event_queue &queue) { |
| 993 | std::string line; |
| 994 | int linenum = 0; |
| 995 | int64_t numevents = 0; |
| 996 | |
| 997 | while (!queue.empty()) { |
| 998 | int rc; |
| 999 | linenum++; |
| 1000 | cson_value *event_val = queue.get(); |
| 1001 | const char *type = get_strprop(event_val, "type"); |
| 1002 | if (type != nullptr) { |
| 1003 | handle(cdb2h, type, event_val); |
| 1004 | if (had_errors) { |
| 1005 | had_errors = 0; |
| 1006 | cdb2_close(cdb2h); |
| 1007 | char *conf = getenv("CDB2_CONFIG"); |
| 1008 | if (conf) { |
| 1009 | cdb2_set_comdb2db_config(conf); |
| 1010 | rc = cdb2_open(&cdb2h, dbname, "default", 0); |
| 1011 | } else { |
| 1012 | rc = cdb2_open(&cdb2h, dbname, "local", 0); |
| 1013 | } |
| 1014 | db = cdb2h; |
| 1015 | } |
| 1016 | numevents++; |
| 1017 | if (maxevents && numevents >= maxevents) |
| 1018 | break; |
| 1019 | } |
| 1020 | else |
| 1021 | cson_free_value(event_val); |
| 1022 | } |
| 1023 | if (verbose) |
| 1024 | std::cout << "got " << linenum << " lines" << std::endl; |
| 1025 | } |
| 1026 | |
| 1027 | int main(int argc, char **argv) { |
| 1028 | char *filename = nullptr; |
no test coverage detected