[prev in list] [next in list] [prev in thread] [next in thread]
List: nagios-devel
Subject: [Nagios-devel] [PATCH 2/2] Use compare_strings() instead of
From: Thomas Guyot-Sionnest <dermoth () aei ! ca>
Date: 2009-08-15 22:18:34
Message-ID: 1250374714-5842-3-git-send-email-dermoth () aei ! ca
[Download RAW message or body]
compare_strings() is a frontend for compare_hashdata() where the 2nd compare
value is always NULL.
---
common/comments.c | 8 ++++----
common/statusdata.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/common/comments.c b/common/comments.c
index 3d15bc5..87356d5 100644
--- a/common/comments.c
+++ b/common/comments.c
@@ -398,8 +398,8 @@ int add_comment_to_hashlist(comment *new_comment){
hashslot=hashfunc(new_comment->host_name,NULL,COMMENT_HASHSLOTS);
lastpointer=NULL;
- for(temp_comment=comment_hashlist[hashslot];temp_comment && \
compare_hashdata(temp_comment->host_name,NULL,new_comment->host_name,NULL)<0;temp_comment=temp_comment->nexthash){
- if(compare_hashdata(temp_comment->host_name,NULL,new_comment->host_name,NULL)>=0)
+ for(temp_comment=comment_hashlist[hashslot];temp_comment && \
compare_strings(temp_comment->host_name,new_comment->host_name)<0;temp_comment=temp_comment->nexthash){
+ if(compare_strings(temp_comment->host_name,new_comment->host_name)>=0)
break;
lastpointer=temp_comment;
}
@@ -629,9 +629,9 @@ comment *get_next_comment_by_host(char *host_name, comment \
*start){ else
temp_comment=start->nexthash;
- for(;temp_comment && \
compare_hashdata(temp_comment->host_name,NULL,host_name,NULL)<0;temp_comment=temp_comment->nexthash);
+ for(;temp_comment && \
compare_strings(temp_comment->host_name,host_name)<0;temp_comment=temp_comment->nexthash);
- if(temp_comment && \
compare_hashdata(temp_comment->host_name,NULL,host_name,NULL)==0) + if(temp_comment \
&& compare_strings(temp_comment->host_name,host_name)==0) return temp_comment;
return NULL;
diff --git a/common/statusdata.c b/common/statusdata.c
index a04c900..ed245f3 100644
--- a/common/statusdata.c
+++ b/common/statusdata.c
@@ -255,10 +255,10 @@ int add_hoststatus_to_hashlist(hoststatus *new_hoststatus){
hashslot=hashfunc(new_hoststatus->host_name,NULL,HOSTSTATUS_HASHSLOTS);
lastpointer=NULL;
- for(temp_hoststatus=hoststatus_hashlist[hashslot];temp_hoststatus && \
compare_hashdata(temp_hoststatus->host_name,NULL,new_hoststatus->host_name,NULL)<0;temp_hoststatus=temp_hoststatus->nexthash)
+ for(temp_hoststatus=hoststatus_hashlist[hashslot];temp_hoststatus && \
compare_strings(temp_hoststatus->host_name,new_hoststatus->host_name)<0;temp_hoststatus=temp_hoststatus->nexthash)
lastpointer=temp_hoststatus;
- if(!temp_hoststatus || \
(compare_hashdata(temp_hoststatus->host_name,NULL,new_hoststatus->host_name,NULL)!=0)){
+ if(!temp_hoststatus || \
(compare_strings(temp_hoststatus->host_name,new_hoststatus->host_name)!=0)){ \
if(lastpointer) lastpointer->nexthash=new_hoststatus;
else
@@ -519,9 +519,9 @@ hoststatus *find_hoststatus(char *host_name){
if(host_name==NULL || hoststatus_hashlist==NULL)
return NULL;
- for(temp_hoststatus=hoststatus_hashlist[hashfunc(host_name,NULL,HOSTSTATUS_HASHSLOTS)];temp_hoststatus \
&& compare_hashdata(temp_hoststatus->host_name,NULL,host_name,NULL)<0;temp_hoststatus=temp_hoststatus->nexthash);
+ for(temp_hoststatus=hoststatus_hashlist[hashfunc(host_name,NULL,HOSTSTATUS_HASHSLOTS)];temp_hoststatus \
&& compare_strings(temp_hoststatus->host_name,host_name)<0;temp_hoststatus=temp_hoststatus->nexthash);
- if(temp_hoststatus && \
(compare_hashdata(temp_hoststatus->host_name,NULL,host_name,NULL)==0)) \
+ if(temp_hoststatus && (compare_strings(temp_hoststatus->host_name,host_name)==0)) \
return temp_hoststatus;
return NULL;
--
1.6.4
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-devel mailing list
Nagios-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic