case-map: Remove buggy and unused case_map_clone().
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 4 Mar 2023 01:55:12 +0000 (17:55 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 5 Mar 2023 19:23:16 +0000 (11:23 -0800)
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
src/data/case-map.h

index b47d38e1dd1346df17454ed4c20f4dff432da806..968b945af2a9318a74324b458b9382a212dbab96 100644 (file)
@@ -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)
index 13e2ef190f4a0f79716bf3d3d40a4da99f8b05e8..3e1f8be41f1466854176d330f3117794c12dead3 100644 (file)
@@ -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 *);