Initialize a new RETURN aggregation group */
| 5210 | |
| 5211 | /* Initialize a new RETURN aggregation group */ |
| 5212 | static void ret_agg_init_group(ret_agg_entry_t *entry, const char *key, int item_count, |
| 5213 | const char **vals) { |
| 5214 | snprintf(entry->group_key, sizeof(entry->group_key), "%s", key); |
| 5215 | entry->group_vals = calloc(item_count, sizeof(const char *)); |
| 5216 | entry->sums = calloc(item_count, sizeof(double)); |
| 5217 | entry->counts = calloc(item_count, sizeof(int)); |
| 5218 | /* calloc: the sentinel loop below overwrites every slot, but the bound |
| 5219 | * equality with the accumulate loop is invisible to path-sensitive |
| 5220 | * analysis; zeroed backing keeps any modeled mismatch defined. */ |
| 5221 | entry->mins = calloc(item_count, sizeof(double)); |
| 5222 | entry->maxs = calloc(item_count, sizeof(double)); |
| 5223 | entry->collect_lists = calloc(item_count, sizeof(char **)); |
| 5224 | entry->collect_counts = calloc(item_count, sizeof(int)); |
| 5225 | entry->distinct_sets = |
| 5226 | cbm_calloc(CBM_MEM_CLASS_OTHER, (size_t)item_count * sizeof(CBMHashTable *)); |
| 5227 | for (int ci = 0; ci < item_count; ci++) { |
| 5228 | entry->mins[ci] = CYP_DBL_MAX; |
| 5229 | entry->maxs[ci] = -CYP_DBL_MAX; |
| 5230 | entry->group_vals[ci] = heap_strdup(vals[ci]); |
| 5231 | } |
| 5232 | } |
| 5233 | |
| 5234 | /* Accumulate a binding into RETURN aggregation */ |
| 5235 | static bool binding_has_value(binding_t *b, const char *var, const char *prop) { |
no test coverage detected