summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@banu.com>2008-06-10 09:51:23 +0530
committerMukund Sivaraman <muks@banu.com>2008-06-10 09:51:23 +0530
commit95c1f39f6039dc82346f3e024e86a23b7103a0a6 (patch)
tree65eb7721190f8a469541b92574b1757547c47e18
parent5ea289d82ea412b59bbabd1ddfff70d3d5f1ecb2 (diff)
downloadtinyproxy-95c1f39f6039dc82346f3e024e86a23b7103a0a6.tar.gz
tinyproxy-95c1f39f6039dc82346f3e024e86a23b7103a0a6.zip
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).
-rw-r--r--src/html-error.c13
1 files changed, 7 insertions, 6 deletions
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