flux-core
flux-core copied to clipboard
libutil: add destruction wrapper functions
to avoid compiler warnings I've made a number of:
/* zhashx_destructor_fn */
static void json_decref_wrapper (void **arg)
{
json_t **o = arg;
json_decref (*o);
}
funtions scattered around flux. It might be nice to stick em somewhere common so we don't have to keep on re-defining them. I'm sure there's more of them out there, but I always use the "_wrapper" suffix, not sure what other suffixes others used.
Bonus points: write a macro to auto-do this, like JSON_DECREF_ZHASH_DESTROY or something???
Suggest not using the json_
prefix because then it's hard to tell what's part of jansson and what's not when perusing the code.
Since this is the zeromq destructor footprint maybe we could start a zutil_
class in libzmqutil. (e.g. zutil_json_destructor()
or similar.