A worker node copied into this buffer brings the spans it gathered there. */
| 1065 | |
| 1066 | /* A worker node copied into this buffer brings the spans it gathered there. */ |
| 1067 | static void gb_adopt_spans(cbm_gbuf_t *gb, const cbm_gbuf_node_t *node, const gb_span_vec_t *from) { |
| 1068 | if (!node || !node->qualified_name || !from || from->count == 0) { |
| 1069 | return; |
| 1070 | } |
| 1071 | if (!gb->variant_spans) { |
| 1072 | gb->variant_spans = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, 0); |
| 1073 | if (!gb->variant_spans) { |
| 1074 | return; |
| 1075 | } |
| 1076 | } |
| 1077 | gb_span_vec_t *vec = cbm_ht_get(gb->variant_spans, node->qualified_name); |
| 1078 | if (!vec) { |
| 1079 | vec = cbm_calloc(CBM_MEM_CLASS_GBUF_INDEX, sizeof(*vec)); |
| 1080 | if (!vec) { |
| 1081 | return; |
| 1082 | } |
| 1083 | cbm_ht_set(gb->variant_spans, node->qualified_name, vec); |
| 1084 | } |
| 1085 | gb_append_spans(gb, vec, from); |
| 1086 | } |
| 1087 | |
| 1088 | static void gb_span_vec_free(gb_span_vec_t *vec) { |
| 1089 | if (vec) { |
no test coverage detected