From e0b27f6f4cde2d52508db337c76ea81a8ca8ee79 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 3 Mar 2023 17:55:12 -0800 Subject: [PATCH] case-map: Remove buggy and unused case_map_clone(). The xmemdup() in the implementation copied 'old->proto' to 'new->map', which can't possibly work. We could fix it but it wasn't used anyway. --- src/data/case-map.c | 16 ---------------- src/data/case-map.h | 1 - 2 files changed, 17 deletions(-) diff --git a/src/data/case-map.c b/src/data/case-map.c index b47d38e1dd..968b945af2 100644 --- a/src/data/case-map.c +++ b/src/data/case-map.c @@ -72,22 +72,6 @@ insert_mapping (struct case_map *map, size_t from, size_t to) map->map[to] = from; } -/* Returns a copy of OLD, if OLD is nonnull, and otherwise returns NULL. */ -struct case_map * -case_map_clone (const struct case_map *old) -{ - if (!old) - return NULL; - - size_t n_values = caseproto_get_n_widths (old->proto); - struct case_map *new = xmalloc (sizeof *new); - *new = (struct case_map) { - .proto = caseproto_ref (old->proto), - .map = xmemdup (old->proto, n_values * sizeof *new->map), - }; - return new; -} - /* Destroys case map MAP. */ void case_map_destroy (struct case_map *map) diff --git a/src/data/case-map.h b/src/data/case-map.h index 13e2ef190f..3e1f8be41f 100644 --- a/src/data/case-map.h +++ b/src/data/case-map.h @@ -32,7 +32,6 @@ struct casewriter; struct ccase; struct dictionary; -struct case_map *case_map_clone (const struct case_map *); void case_map_destroy (struct case_map *); struct ccase *case_map_execute (const struct case_map *, struct ccase *); -- 2.30.2