Skip to content

Commit

Permalink
Use a different struct type for key types
Browse files Browse the repository at this point in the history
This should help to identify cases where the Key and Value types are
mixed up.
  • Loading branch information
fragglet committed Dec 17, 2024
1 parent c60fd4a commit 1c07312
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/alt-value-type.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-DTEST_ALTERNATE_VALUE_TYPES, this file will be included to define
different types and confirm the library still builds. */

typedef struct {
void *ptr;
int v;
} StructType2;

typedef struct {
int a, b;
} StructType;

#define STRUCT_TYPE_NULL {0, 0}
#define STRUCT_TYPE2_NULL {(void *) 0, 0}

typedef StructType ArrayListValue;
#define ARRAY_LIST_NULL STRUCT_TYPE_NULL

typedef StructType AVLTreeKey;
typedef StructType2 AVLTreeKey;
typedef StructType AVLTreeValue;
#define AVL_TREE_NULL STRUCT_TYPE_NULL

typedef StructType BinaryHeapValue;
#define BINARY_HEAP_NULL STRUCT_TYPE_NULL

Expand All @@ -44,7 +51,8 @@ typedef StructType BinomialHeapValue;
typedef StructType BloomFilterValue;
#define BLOOM_FILTER_NULL STRUCT_TYPE_NULL

typedef StructType HashTableKey;
typedef StructType2 HashTableKey;
#define HASH_TABLE_KEY_NULL STRUCT_TYPE2_NULL
typedef StructType HashTableValue;
#define HASH_TABLE_NULL STRUCT_TYPE_NULL

Expand All @@ -54,7 +62,7 @@ typedef StructType ListValue;
typedef StructType QueueValue;
#define QUEUE_NULL STRUCT_TYPE_NULL

typedef StructType RBTreeKey;
typedef StructType2 RBTreeKey;
typedef StructType RBTreeValue;
#define RB_TREE_NULL STRUCT_TYPE_NULL

Expand Down

0 comments on commit 1c07312

Please sign in to comment.