You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by as...@apache.org on 2015/12/11 15:44:59 UTC

svn commit: r1719435 - in /serf/trunk: serf_bucket_types.h test/test_buckets.c

Author: astieger
Date: Fri Dec 11 14:44:59 2015
New Revision: 1719435

URL: http://svn.apache.org/viewvc?rev=1719435&view=rev
Log:
SERF_BUCKET_SIMPLE_STRING{,_LEN} macros could not be used as function
arguments.

* serf_bucket_types.h
  (SERF_BUCKET_SIMPLE_STRING,SERF_BUCKET_SIMPLE_STRING_LEN):
   remove trailing semicolon
* test/test_buckets.c
  (test_response_bucket_read): add trailing semicolon in call.

Found by: brane

Modified:
    serf/trunk/serf_bucket_types.h
    serf/trunk/test/test_buckets.c

Modified: serf/trunk/serf_bucket_types.h
URL: http://svn.apache.org/viewvc/serf/trunk/serf_bucket_types.h?rev=1719435&r1=1719434&r2=1719435&view=diff
==============================================================================
--- serf/trunk/serf_bucket_types.h (original)
+++ serf/trunk/serf_bucket_types.h Fri Dec 11 14:44:59 2015
@@ -392,10 +392,10 @@ serf_bucket_t *serf_bucket_simple_own_cr
     serf_bucket_alloc_t *allocator);
 
 #define SERF_BUCKET_SIMPLE_STRING(s,a) \
-    serf_bucket_simple_create(s, strlen(s), NULL, NULL, a);
+    serf_bucket_simple_create(s, strlen(s), NULL, NULL, a)
 
 #define SERF_BUCKET_SIMPLE_STRING_LEN(s,l,a) \
-    serf_bucket_simple_create(s, l, NULL, NULL, a);
+    serf_bucket_simple_create(s, l, NULL, NULL, a)
 
 /* ==================================================================== */
 

Modified: serf/trunk/test/test_buckets.c
URL: http://svn.apache.org/viewvc/serf/trunk/test/test_buckets.c?rev=1719435&r1=1719434&r2=1719435&view=diff
==============================================================================
--- serf/trunk/test/test_buckets.c (original)
+++ serf/trunk/test/test_buckets.c Fri Dec 11 14:44:59 2015
@@ -315,7 +315,7 @@ static void test_response_bucket_read(Cu
             "abc1234" /* NO CRLF... just 7 bytes!*/
             "HTTP/1.1 304 Unmodified" CRLF
             CRLF,
-            alloc)
+            alloc);
 
     bkt = serf_bucket_response_create(
               serf_bucket_barrier_create(tmp, alloc),



RE: svn commit: r1719435 - in /serf/trunk: serf_bucket_types.h test/test_buckets.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: astieger@apache.org [mailto:astieger@apache.org]
> Sent: vrijdag 11 december 2015 15:45
> To: dev@serf.apache.org
> Subject: svn commit: r1719435 - in /serf/trunk: serf_bucket_types.h
> test/test_buckets.c
> 
> Author: astieger
> Date: Fri Dec 11 14:44:59 2015
> New Revision: 1719435
> 
> URL: http://svn.apache.org/viewvc?rev=1719435&view=rev
> Log:
> SERF_BUCKET_SIMPLE_STRING{,_LEN} macros could not be used as function
> arguments.

I found this problem a few months ago...

But before applying a 'fix' for this issue like you did I was thinking that perhaps this wasn't some error, but explicitly to avoid having users do this as a function argument.

With the s argument evaluated multiple times, etc.

I'm not entirely sure if we should really fix this this way...
(The fix is also not 100% backwards compatible)


I would like to know what the original author of these macros thinks... He must have noticed this somewhere.


In my specific case I found a bug in my code where I tried to use this as a function... I was almost double allocating things here. (once for sending, and once for the strlen call). In that case it really helped that I couldn't use this as a normal function.

	Bert