httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Clark <g...@dcs.ed.ac.uk>
Subject Re: bug in ApacheRequest_parse macro
Date Thu, 10 Jul 2003 02:42:14 GMT
> Thanks!  So the bug is caused by the missing parens for req, 
> right? Hmm, what about the other #define's in apache_request.h?  
> Shouldn't we fix those also?

Oops, I was so lazy I didn't look! Sorry.

Here's an update. It compiles, but is untested (but then again, the
changes are trivial).

By the way, I had a look at the web site, but I'm uncertain what the
best way to contribute changes is. Is there a CVS repository, or are
changes vetted by the apreq team? Should patches be posted to this
list?

Thanks,
Graham

--- apache_request.h-orig	2003-07-09 22:32:01.000000000 -0500
+++ apache_request.h	2003-07-09 22:33:12.000000000 -0500
@@ -60,19 +60,19 @@
 };
 
 #ifndef strEQ
-#define strEQ(s1,s2) (!strcmp(s1,s2))
+#define strEQ(s1,s2) (!strcmp((s1),(s2)))
 #endif
 
 #ifndef strEQN
-#define strEQN(s1,s2,n) (!strncmp(s1,s2,n))
+#define strEQN(s1,s2,n) (!strncmp((s1),(s2),(n)))
 #endif
 
 #ifndef strcaseEQ
-#define strcaseEQ(s1,s2) (!strcasecmp(s1,s2))
+#define strcaseEQ(s1,s2) (!strcasecmp((s1),(s2)))
 #endif
 
 #ifndef strncaseEQ
-#define strncaseEQ(s1,s2,n) (!strncasecmp(s1,s2,n))
+#define strncaseEQ(s1,s2,n) (!strncasecmp((s1),(s2),(n)))
 #endif
 
 #define DEFAULT_TABLE_NELTS 10
@@ -97,7 +97,7 @@
 char *ApacheRequest_params_as_string(ApacheRequest *req, const char *key);
 int ApacheRequest___parse(ApacheRequest *req);
 #define ApacheRequest_parse(req) \
-    (req->status = req->parsed ? req->status : ApacheRequest___parse(req)) 
+    ((req)->status = (req)->parsed ? (req)->status : ApacheRequest___parse(req))

 table *ApacheRequest_query_params(ApacheRequest *req, ap_pool *p);
 table *ApacheRequest_post_params(ApacheRequest *req, ap_pool *p);
 
@@ -106,20 +106,20 @@
 ApacheUpload *ApacheUpload_find(ApacheUpload *upload, char *name);
 
 #define ApacheRequest_upload(req) \
-    ((req->parsed || (ApacheRequest_parse(req) == OK)) ? req->upload : NULL)
+    (((req)->parsed || (ApacheRequest_parse(req) == OK)) ? (req)->upload : NULL)
 
-#define ApacheUpload_FILE(upload) (upload->fp)
+#define ApacheUpload_FILE(upload) ((upload)->fp)
 
-#define ApacheUpload_size(upload) (upload->size)
+#define ApacheUpload_size(upload) ((upload)->size)
 
 #define ApacheUpload_info(upload, key) \
-ap_table_get(upload->info, key)
+ap_table_get((upload)->info, (key))
 
 #define ApacheUpload_type(upload) \
-ApacheUpload_info(upload, "Content-Type")
+ApacheUpload_info((upload), "Content-Type")
 
-#define ApacheRequest_set_post_max(req, max) (req->post_max = max)
-#define ApacheRequest_set_temp_dir(req, dir) (req->temp_dir = dir)
+#define ApacheRequest_set_post_max(req, max) ((req)->post_max = (max))
+#define ApacheRequest_set_temp_dir(req, dir) ((req)->temp_dir = (dir))
 
 char *ApacheUtil_expires(pool *p, char *time_str, int type);
 #define EXPIRES_HTTP   1
@@ -133,7 +133,7 @@
 #define REQ_ERROR APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, req->r
 
 #ifdef REQDEBUG
-#define REQ_DEBUG(a) a
+#define REQ_DEBUG(a) (a)
 #else
 #define REQ_DEBUG(a)
 #endif

Mime
View raw message