prevent remove_both_duplicates from leaking invalid pointer.

Previously, the function remove_both_duplicates would not properly
set the passed in pointer array to NULL if the array consisted completely
of duplicate entries. This would lead to a segmentation fault further
downstream.
Simplified function remove_both_duplicates.
Made version check type safe.
Cleaned up util.c and removed infinite array

data structures and functions since they were unused.