troydhanson / uthash

C macros for hash tables and more
Other
4.18k stars 926 forks source link

oom() calls exit(): This makes this library unfit for usage in shared libraries #174

Closed xuhdev closed 5 years ago

xuhdev commented 5 years ago

For example,

https://stackoverflow.com/questions/14199689/how-can-i-handle-exit-calls-in-3rd-party-library-code

editorconfig/editorconfig-core-c#12

Quuxplusone commented 5 years ago

I think you're asking about oom in utarray.h. If that's not the case, please update this issue with some more context, e.g. one or more complete sentences in the issue description.

The macro oom in utarray.h is specifically provided so that you can plug in something other than exit, without any change to your source code. (Admittedly, it should probably be named utarray_oom or something. Patches will be considered.)

See also HASH_NONFATAL_OOM as implemented in commit 01e5a878d7660e07177a7cb056c769297374d9e3. (Just in case you're asking about uthash.h.)

xuhdev commented 5 years ago

Thank you! I've made a PR for the proposed fix.

xuhdev commented 5 years ago

@Quuxplusone Seems you forgot to push the commit to this repo :)