Skip to content

Improve const correctness in hash_table_insert #7

@andrewthecodertx

Description

@andrewthecodertx

The hash_table_insert function currently takes void *key and void *value as arguments. However, the function does not modify the pointed-to data; it only reads from it to make a copy.

The function signature should be changed to:

bool hash_table_insert(HashTable *table, const void *key, const void *value);

This change improves the API's correctness and allows users to pass const-qualified data without unnecessary casting, making the API safer and easier to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions