Christian Grothoff <[email protected]> writes: > Hi Alessio, > > The idea is good, but I dislike two details: > > 1) GNUNET_PLUGIN_load_all_default should be a function, not a macro;
It's a macro because the original `load_all' is declared with a void return value, so instead of calling two functions (`load_all_default' and `load_all') it simply expands in place. It's probably just a micro-optimization, but I can't see why it should be a function when there are macros with more complex bodies. > 2) It should be "load_all_with_context" > and we should give it the "GNUNET_OS_ProjectData" > to use as an argument, i.e.: > > GNUNET_PLUGIN_load_all_with_context ( > GNUNET_OS_project_data_default(), ...) > > would do exactly what your code does. > > IMO, that pattern is more widely usable. Admittedly, I didn't think of applications using non-GNUnet's services lazy-loading plugins. > Also, we should consider making the 'context' a thread-local (which, if > unset, is set from a corresponding global?) so that these operations > remain thread-safe. Martin, WDYT? I can submit another patch once an agreement is met. Thanks, A.V.
