Triple code duplication
Karl Vogel <[email protected]>
| Newsgroups | gmane.comp.kde.devel.optimize |
|---|---|
| Message-ID | <[email protected]> |
While converting kdelibs to a version that explicitly defines what should be exported (using KDE_EXPORT), I noticed that a few things are duplicated. For example: $ objdump -CT /opt/kde/lib/kde3/kbzip2filter.so |grep init_ 00001ff0 g DF .text 00000052 Base init_kbzip2filter $ objdump -CT /opt/kde/lib/kde3/kio_help.so |grep init_ 0000d900 g DF .text 00000052 Base init_kbzip2filter $ objdump -CT /opt/kde/lib/kde3/kio_ghelp.so |grep init_ 0000d900 g DF .text 00000052 Base init_kbzip2filter kdelibs/kdoctools uses kbzip2filter.cpp and compiles it directly into the kio_help.so and kio_ghelp.so shared libs. Since this is exactly the same sourcecode as kioslave/bzip2, we now end up with this code duplicated 3 times! I'm also wary as I think this can introduce subtle bugs.. ie if one of those versions is used and then another shared lib is opened containing a version, won't this override the present version ?! What if some state is kept in a global variable that is now overridden by the new version!