Extending the pblock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. 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 is better, as the function is exported in the .so, it's accessible
to other languages, it's simpler to implement, we stop needing more
macro definitions. 

It also has performance benefits, as these functions can be inlined by
GCC, the function lookup is likely quicker than the case switch, it's
also easier to set breakpoints on for debugging.

So for now, I want to make new additions to pblock.c in this form.

One day in the future we can tackle breaking pblock.c down from the
current case switch style, but it is not this day.

What do we think? Are we happy for me to use this style for new
additions? 

-- 
Sincerely,

William Brown
Software Engineer
Red Hat, Brisbane

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux