Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding mechanism for user-defined allocation/hashing #1

Open
sbseltzer opened this issue Oct 24, 2017 · 3 comments
Open

Consider adding mechanism for user-defined allocation/hashing #1

sbseltzer opened this issue Oct 24, 2017 · 3 comments

Comments

@sbseltzer
Copy link

This is a nice library. Thanks for making it!

A number of other C libraries I've used include facilities for users optionally specifying their own allocation and hashing methods. This can be quite useful for testing and portability. Perhaps you could consider adding something like this?

@chriso
Copy link
Owner

chriso commented Oct 24, 2017

It's not something I need personally, but I'd be happy to accept a PR if it's useful for somebody else.

You could allow compile-time function names to be passed via config.h.

@sbseltzer
Copy link
Author

sbseltzer commented Oct 25, 2017

Thanks for the response! I was considering working on a PR with that plus unit tests, as I usually get nervous when I don't see unit tests with something. Libraries that intern stuff are nice to test with malloc/free wrappers to ensure memory management works as expected on all platforms, but for now I can settle for using valgrind.

I'm hoping to use this for a very cross-platform project so if I come across portability problems that are simple to fix I'll probably fork and submit a PR.

@chriso
Copy link
Owner

chriso commented Oct 25, 2017

There's good coverage of the library in ./tests.c that passes valgrind and clang's analysis tools without errors (although I haven't checked recently). You can run the tests using:

$ mkdir build && cd build
$ cmake ..
$ make check

I'd be happy to accept any portability fixes but I imagine CMake does a good job already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants