On Mon, 2016-11-21 at 12:53 -0500, Mark Reynolds wrote:
On 11/20/2016 08:17 PM, William Brown wrote:
> Hi,
>
> I have to add some new getters to pblock.c, but I think we should talk
> about how to add these.
>
> Right now, we have a nearly ~2000 line case switch statement in
> slapi_pblock_get(pb, TYPE, *void). No matter how we cut it, this is
> pretty insane.
:-) Yeah its a bit much at the moment.
> We have huge amounts of defines in slapi-plugin.h for
> this, and we can't expose those to other langs (python, rust), because
> they are in a C header file.
>
> As well, case switch statements that large, at some point, it's going to
> be inefficient to access.
>
> I think that we should try to break this up, it's just a bit much at
> this point.
>
> So for new additions I would like to use:
>
> slapi_pblock_get_<item>(pblock, out) {
> *out = pb->item
> }
This works for me, but if I may, I propose that we tweak the naming
style to:
slapi_pb_get_<item>(Slapi_PBlock *pb)
slapi_pb_set_<item>(Slapi_PBlock *pb, ...)
This way we differentiate the new functions, and two, it helps keep the
function name from getting too long.
Okay, that could be the way to go.
I need to get something from the connection, so maybe I'll wire up a
patch as a demo of what I want to achieve. I certainly don't want to
extend the pblock, if anything I want to get us to break it down and
compact it.
--
Sincerely,
William Brown
Software Engineer
Red Hat, Brisbane