[syslog-ng]1.9.3 compatibility with glib 2.2

Gilles Demarty syslog-ng@lists.balabit.hu
Mon, 28 Feb 2005 09:36:13 +0100


Hi all,

on my way trying to compile syslog-ng 1.9.3 on a RedHat Entreprise 
Server 3.0 with glib 2.2, the only compiling error was the existence of 
g_queue_get_length() in afinter.c. g_queue_get_length() is a function 
introduced since glib 2.4.

I wonder why you prefer using g_queue_get_length() instead of 
g_queue_is_empty() in that particular context, since you do a double neg 
of that value to get a gboolean.

Therefore, I propose the following patch. This patch allow compatibility 
with glib 2.2, and is, i hope,  more efficient (since a non empty test 
shoud be as efficient as an enumeration).

# diff afinter.c ~/syslog-1.9.3-patched/src/afinter.c
35c35
<   return !!g_queue_get_length(internal_msg_queue);
---
 >   return !g_queue_is_empty(internal_msg_queue);
41c41
<   return !!g_queue_get_length(internal_msg_queue);
---
 >   return !g_queue_is_empty(internal_msg_queue);

my €.02

-- 
Gilles DEMARTY
ExaProtect Technology
Tél: +33 (0) 4 26 23 25 25
Fax: +33 (0) 4 26 29 99 09
email(at)exaprotect.com
www.exaprotect.com - "Be alert with your alerts"