[Nagios-devel] [PATCH 2/2] Use compare_strings() instead of
Posted: Sat Aug 15, 2009 9:45 pm
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)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)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)nexthash);
+ for(;temp_comment && compare_strings(temp_comment->host_name,host_name)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)nexthash)
+ for(temp_hoststatus=hoststatus_hashlist[hashslot];temp_hoststatus && compare_strings(temp_hoststatus->host_name,new_hoststatus->host_name)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)nexthash);
+ for(temp_hoststatus=hoststatus_hashlist[hashfunc(host_name,NULL,HOSTSTATUS_HASHSLOTS)];temp_hoststatus && compare_strings(temp_hoststatus->host_name,host_name)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
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
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)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)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)nexthash);
+ for(;temp_comment && compare_strings(temp_comment->host_name,host_name)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)nexthash)
+ for(temp_hoststatus=hoststatus_hashlist[hashslot];temp_hoststatus && compare_strings(temp_hoststatus->host_name,new_hoststatus->host_name)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)nexthash);
+ for(temp_hoststatus=hoststatus_hashlist[hashfunc(host_name,NULL,HOSTSTATUS_HASHSLOTS)];temp_hoststatus && compare_strings(temp_hoststatus->host_name,host_name)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
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]