Saving the world one uW at a time : ekiga
December 11, 2008
When I saw that post, I dived into the list of “affected” programs, and went “ooohhh!!!” becauseĀ ekiga was in the list.
I played the grep game in the sources, quickly found a few places where the problem applied and patched… then stumbled on a place where the fix was half-in. Why half? Because there was a #if GLIB_CHECK_VERSION(2,14,0) … #else … #endif ! After the first moment of surprise (gaping mouth), I jumped into configure.ac and saw that indeed we only require glib version 2.8.0. Ha!
I modified every applicable place to use g_timeout_add_seconds only if the right glib version is available even though I really don’t like #if code : consider the problem fixed for ekiga!
So there are a few things to know about this problem :
- one can’t just patch like this because maybe the maintainers still support an older glib : either the dep has to stay lower and #if/#else/#endif should be used, or the expected version should be raised ;
- even if grep says there’s a problem in a program, it may just be seeing the #else part of a #if GLIB_CHECK_VERSION part : there are false positives!
Thanks to Ted for the heads up!
December 11, 2008 at 19:32
Perhaps you could do a single #if in a header. Something like:
#if ! GLIB_CHECK_VERSION(2,14,0)
# define g_timeout_add_seconds(interval, function, data) g_timeout_add((interval)*1000, (function), (data))
#endif
I agree that sprinkling ifdefs throughout the code is a bad idea.