From 95c1f39f6039dc82346f3e024e86a23b7103a0a6 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Tue, 10 Jun 2008 09:51:23 +0530 Subject: Don't check the value to be inserted as it's already checked This change primarily avoids a gcc warning where timebuf is never non-NULL. There is no need to check the value to be inserted as it's checked inside hashmap_insert(). This changeset also lets error return values from hashmap_insert() propogate instead of clamping them to -1 (not that these are currently used anyway). --- src/html-error.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/html-error.c b/src/html-error.c index 398420b..4a07793 100644 --- a/src/html-error.c +++ b/src/html-error.c @@ -232,14 +232,15 @@ add_error_variable(struct conn_s *connptr, char *key, char *val) hashmap_create(ERRVAR_BUCKETCOUNT))) return (-1); - if (hashmap_insert(connptr->error_variables, key, val, - strlen(val) + 1) < 0) - return (-1); - - return (0); + return hashmap_insert(connptr->error_variables, key, val, + strlen(val) + 1); } -#define ADD_VAR_RET(x, y) if(y) { if(add_error_variable(connptr, x, y) == -1) return(-1); } +#define ADD_VAR_RET(x, y) \ + do { \ + if (add_error_variable(connptr, x, y) < 0) \ + return -1; \ + } while (0) /* * Set some standard variables used by all HTML pages -- cgit v1.2.3