serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject svn commit: r1754719 - in /serf/trunk: auth/auth.c buckets/aggregate_buckets.c buckets/chunk_buckets.c buckets/fcgi_buckets.c src/logging.c test/CuTest.c
Date Mon, 01 Aug 2016 09:54:15 GMT
Author: ivan
Date: Mon Aug  1 09:54:15 2016
New Revision: 1754719

URL: http://svn.apache.org/viewvc?rev=1754719&view=rev
Log:
Style fixes: reduce scope of local variables. Reported on dev@ list:
https://www.mail-archive.com/dev%40serf.apache.org/msg01303.html

* auth/auth.c
* buckets/aggregate_buckets.c
* buckets/chunk_buckets.c
* buckets/fcgi_buckets.c
* src/logging.c
* test/CuTest.c
  (dispatch_auth, serf_aggregate_read_bucket, create_chunk, fcgi_serialize,
   serf__log_nopref, serf__log, CuSuiteDetails): Reduce scope of local
   variables.

Modified:
    serf/trunk/auth/auth.c
    serf/trunk/buckets/aggregate_buckets.c
    serf/trunk/buckets/chunk_buckets.c
    serf/trunk/buckets/fcgi_buckets.c
    serf/trunk/src/logging.c
    serf/trunk/test/CuTest.c

Modified: serf/trunk/auth/auth.c
URL: http://svn.apache.org/viewvc/serf/trunk/auth/auth.c?rev=1754719&r1=1754718&r2=1754719&view=diff
==============================================================================
--- serf/trunk/auth/auth.c (original)
+++ serf/trunk/auth/auth.c Mon Aug  1 09:54:15 2016
@@ -216,9 +216,8 @@ static apr_status_t dispatch_auth(int co
                                   serf_bucket_t *response,
                                   apr_pool_t *pool)
 {
-    serf_bucket_t *hdrs;
-
     if (code == 401 || code == 407) {
+        serf_bucket_t *hdrs;
         auth_baton_t ab = { 0 };
 
         ab.hdrs = apr_hash_make(pool);

Modified: serf/trunk/buckets/aggregate_buckets.c
URL: http://svn.apache.org/viewvc/serf/trunk/buckets/aggregate_buckets.c?rev=1754719&r1=1754718&r2=1754719&view=diff
==============================================================================
--- serf/trunk/buckets/aggregate_buckets.c (original)
+++ serf/trunk/buckets/aggregate_buckets.c Mon Aug  1 09:54:15 2016
@@ -501,7 +501,6 @@ static serf_bucket_t * serf_aggregate_re
     const serf_bucket_type_t *type)
 {
     aggregate_context_t *ctx = bucket->data;
-    serf_bucket_t *found_bucket;
     bucket_list_t *list;
 
     if (!ctx->list) {
@@ -511,7 +510,7 @@ static serf_bucket_t * serf_aggregate_re
     list = ctx->list;
     if (list->bucket->type == type) {
         /* Got the bucket. Consume it from our list. */
-        found_bucket = list->bucket;
+        serf_bucket_t *found_bucket = list->bucket;
         ctx->list = list->next;
 
         /* And destroy the now unused item */

Modified: serf/trunk/buckets/chunk_buckets.c
URL: http://svn.apache.org/viewvc/serf/trunk/buckets/chunk_buckets.c?rev=1754719&r1=1754718&r2=1754719&view=diff
==============================================================================
--- serf/trunk/buckets/chunk_buckets.c (original)
+++ serf/trunk/buckets/chunk_buckets.c Mon Aug  1 09:54:15 2016
@@ -63,8 +63,6 @@ serf_bucket_t *serf_bucket_chunk_create(
 static apr_status_t create_chunk(serf_bucket_t *bucket)
 {
     chunk_context_t *ctx = bucket->data;
-    serf_bucket_t *simple_bkt;
-    apr_size_t chunk_len;
     apr_size_t stream_len;
     /* 64 + chunk trailer + EOF trailer = 66 */
     struct iovec vecs[MIN(APR_MAX_IOVEC_SIZE, SERF__STD_IOV_COUNT + 2)];
@@ -98,6 +96,8 @@ static apr_status_t create_chunk(serf_bu
      * we'll only do this if we have something to write.
      */
     if (stream_len) {
+        serf_bucket_t *simple_bkt;
+        apr_size_t chunk_len;
         /* Build the chunk header. */
         chunk_len = apr_snprintf(ctx->chunk_hdr, sizeof(ctx->chunk_hdr),
                                  "%" APR_UINT64_T_HEX_FMT CRLF,

Modified: serf/trunk/buckets/fcgi_buckets.c
URL: http://svn.apache.org/viewvc/serf/trunk/buckets/fcgi_buckets.c?rev=1754719&r1=1754718&r2=1754719&view=diff
==============================================================================
--- serf/trunk/buckets/fcgi_buckets.c (original)
+++ serf/trunk/buckets/fcgi_buckets.c Mon Aug  1 09:54:15 2016
@@ -510,11 +510,11 @@ static apr_status_t fcgi_params_decode(s
 static void fcgi_serialize(serf_bucket_t *bucket)
 {
     fcgi_params_decode_ctx_t *ctx = bucket->data;
-    serf_bucket_t *tmp;
 
     serf_bucket_aggregate_become(bucket);
 
     if (ctx->method || ctx->path) {
+        serf_bucket_t *tmp;
         if (ctx->method) {
             tmp = serf_bucket_simple_own_create(ctx->method, strlen(ctx->method),
                                                 bucket->allocator);

Modified: serf/trunk/src/logging.c
URL: http://svn.apache.org/viewvc/serf/trunk/src/logging.c?rev=1754719&r1=1754718&r2=1754719&view=diff
==============================================================================
--- serf/trunk/src/logging.c (original)
+++ serf/trunk/src/logging.c Mon Aug  1 09:54:15 2016
@@ -106,7 +106,6 @@ static void log_time(FILE *logfp)
 void serf__log_nopref(apr_uint32_t level, apr_uint32_t comp,
                       serf_config_t *config, const char *fmt, ...)
 {
-    va_list argp;
     log_baton_t *log_baton;
     apr_status_t status;
 
@@ -126,10 +125,11 @@ void serf__log_nopref(apr_uint32_t level
             serf_log_output_t *output = APR_ARRAY_IDX(log_baton->output_list,
                                                       i, serf_log_output_t *);
             if ((output->level >= level) && (comp & output->comps))
{
+                va_list argp;
+
                 va_start(argp, fmt);
                 output->logger(output, config, level, comp, 0, "", fmt, argp);
                 va_end(argp);
-
             }
         }
     }
@@ -138,7 +138,6 @@ void serf__log_nopref(apr_uint32_t level
 void serf__log(apr_uint32_t level, apr_uint32_t comp, const char *prefix,
                serf_config_t *config, const char *fmt, ...)
 {
-    va_list argp;
     log_baton_t *log_baton;
     apr_status_t status;
 
@@ -158,10 +157,11 @@ void serf__log(apr_uint32_t level, apr_u
             serf_log_output_t *output = APR_ARRAY_IDX(log_baton->output_list,
                                                       i, serf_log_output_t *);
             if ((output->level >= level) && (comp & output->comps))
{
+                va_list argp;
+
                 va_start(argp, fmt);
                 output->logger(output, config, level, comp, 1, prefix, fmt, argp);
                 va_end(argp);
-
             }
         }
     }

Modified: serf/trunk/test/CuTest.c
URL: http://svn.apache.org/viewvc/serf/trunk/test/CuTest.c?rev=1754719&r1=1754718&r2=1754719&view=diff
==============================================================================
--- serf/trunk/test/CuTest.c (original)
+++ serf/trunk/test/CuTest.c Mon Aug  1 09:54:15 2016
@@ -385,9 +385,6 @@ void CuSuiteSummary(CuSuite* testSuite,
 
 void CuSuiteDetails(CuSuite* testSuite, CuString* details)
 {
-    int i;
-    int failCount = 0;
-
     if (testSuite->failCount == 0)
     {
         int passCount = testSuite->count - testSuite->failCount;
@@ -396,6 +393,9 @@ void CuSuiteDetails(CuSuite* testSuite,
     }
     else
     {
+        int i;
+        int failCount = 0;
+
         if (testSuite->failCount == 1)
             CuStringAppend(details, "There was 1 failure:\n");
         else



Mime
View raw message