From a71d55cedfa6b226582195add906116a4d5648f7 Mon Sep 17 00:00:00 2001 From: yaworsky Date: Fri, 18 Nov 2005 09:45:14 +0000 Subject: Use the right comparsion function and rename string_compare to string_equal --- daemon/dest_file.c | 20 ++++++++++---------- daemon/string.c | 6 +++--- daemon/syslogd.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/daemon/dest_file.c b/daemon/dest_file.c index 7ede68c..c4d3cfe 100644 --- a/daemon/dest_file.c +++ b/daemon/dest_file.c @@ -67,19 +67,19 @@ static gboolean compare_current_and_first_messages( struct file_writer* writer ) { TRACE_ENTER( "%p\n", writer ); - if( string_compare( writer->current_msg->hostname, - writer->first_msg->hostname ) - || string_compare( writer->current_msg->message, - writer->first_msg->message ) ) + if( string_equal( writer->current_msg->hostname, + writer->first_msg->hostname ) + && string_equal( writer->current_msg->message, + writer->first_msg->message ) ) { - release_message( writer->first_msg ); - writer->first_msg = NULL; - TRACE_LEAVE( "%p done; messages aren't identical\n", writer ); - return FALSE; + TRACE_LEAVE( "%p ok\n" ); + return TRUE; } - TRACE_LEAVE( "%p ok\n" ); - return TRUE; + release_message( writer->first_msg ); + writer->first_msg = NULL; + TRACE_LEAVE( "%p done; messages aren't identical\n", writer ); + return FALSE; } /****************************************************************************** diff --git a/daemon/string.c b/daemon/string.c index 6684664..5dd6a45 100755 --- a/daemon/string.c +++ b/daemon/string.c @@ -108,9 +108,9 @@ struct string* string_printf( gchar* fmt, ... ) return s; } -int string_compare( struct string* s1, struct string* s2 ) +gboolean string_equal( struct string* s1, struct string* s2 ) { if( s1 == s2 ) - return 0; - return strcmp( s1->gstr->str, s2->gstr->str ); + return TRUE; + return g_string_equal( s1->gstr, s2->gstr ); } diff --git a/daemon/syslogd.h b/daemon/syslogd.h index c48f8f8..a70b326 100644 --- a/daemon/syslogd.h +++ b/daemon/syslogd.h @@ -48,7 +48,7 @@ extern void string_release( struct string* s ); extern struct string* string_vprintf( gchar* fmt, va_list args ); extern struct string* string_printf( gchar* fmt, ... ); extern gsize string_concat( gchar** result, struct string* s, ... ); -extern int string_compare( struct string* s1, struct string* s2 ); +extern gboolean string_equal( struct string* s1, struct string* s2 ); /* misc global stuff */ extern HANDLE service_stop_event; -- cgit v1.2.3