This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch span-gl-clean
in repository efl.

View the commit online.

commit 96b3b33f48253ca9a39c5ea8262b7e8c2bd86e38
Author: [email protected] <[email protected]>
AuthorDate: Mon Sep 14 10:00:41 2026 -0600

    evas_ector_gl: flatten blocks that only scoped a declaration
    
    Following the review of span_collector_resize(), remove the other bare
    { } blocks this branch added only to declare a few locals. Their extra
    indentation made the code harder to follow without adding anything.
    
    - evas_ector_gl_span.c: span_collector_clear(), _do_spatial_split() and
      _collect_spans_solid() declare their locals at the top of the
      enclosing scope. _collect_spans_solid() loses two nesting levels in
      its per-span loop.
    - ector_software_rasterizer.c: the collector callback variable joins the
      other declarations of its block.
    - evas_ector_gl_span_shader.c: both shader part builders declare their
      result array at the top.
    - efl_canvas_vg_container.c: the mask drawing context and the
      composite check lose their braces; the file already declares variables
      after statements, so the declarations stay in place.
    - ector_test_span_collector.c: two tests move their locals to the top.
    
    Blocks that C requires (declarations under case labels) and the block
    passed to SPAN_PAGE_FOREACH stay. No moved name clashes with another in
    its scope.
    
    Ignoring whitespace, the diff only removes block braces and moves
    declarations. The build is clean, ector_suite and evas_suite pass, and
    VG expedite tests 117-126 render pixel-identical GL frames.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
 src/lib/ector/software/ector_software_rasterizer.c |  42 ++-
 src/lib/evas/canvas/efl_canvas_vg_container.c      |  40 ++-
 .../evas/engines/gl_generic/evas_ector_gl_span.c   | 294 ++++++++++-----------
 .../engines/gl_generic/evas_ector_gl_span_shader.c |  42 ++-
 src/tests/ector/suite/ector_test_span_collector.c  |  54 ++--
 5 files changed, 227 insertions(+), 245 deletions(-)

diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index 22d6781975..0717e766f5 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -956,6 +956,7 @@ ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
    if (rasterizer->fill_data.span_collector_alloc)
      {
         Span_Data *sd = &rasterizer->fill_data;
+        SW_FT_SpanFunc cb;
         int ch;
 
         // raster_buffer is set by the surface constructor and
@@ -974,29 +975,26 @@ ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
         if (!sd->span_collector) return;
 
         // Select the collector callback based on fill type.
-        {
-           SW_FT_SpanFunc cb;
-           if ((sd->type == LinearGradient) || (sd->type == RadialGradient))
-             cb = sd->collector_gradient;
-           else if (sd->comp)
-             cb = sd->collector_composite;
-           else
-             cb = sd->collector_solid;
+        if ((sd->type == LinearGradient) || (sd->type == RadialGradient))
+          cb = sd->collector_gradient;
+        else if (sd->comp)
+          cb = sd->collector_composite;
+        else
+          cb = sd->collector_solid;
 
-           if (cb)
-             {
-                sd->unclipped_blend = cb;
-                if (sd->clip.enabled)
-                  {
-                     if (sd->clip.type == 0)
-                       sd->blend = &_span_fill_clipRect;
-                     else
-                       sd->blend = &_span_fill_clipPath;
-                  }
-                else
-                  sd->blend = cb;
-             }
-        }
+        if (cb)
+          {
+             sd->unclipped_blend = cb;
+             if (sd->clip.enabled)
+               {
+                  if (sd->clip.type == 0)
+                    sd->blend = &_span_fill_clipRect;
+                  else
+                    sd->blend = &_span_fill_clipPath;
+               }
+             else
+               sd->blend = cb;
+          }
      }
 
    if (rasterizer->fill_data.blend)
diff --git a/src/lib/evas/canvas/efl_canvas_vg_container.c b/src/lib/evas/canvas/efl_canvas_vg_container.c
index 33d9f18ac8..763c23cc5e 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_container.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_container.c
@@ -154,20 +154,18 @@ _prepare_comp(Evas_Object_Protected_Data *obj,     //vector object
         // eng_ector_begin installs span collectors on the shared ector surface;
         // _draw_comp drives ector_renderer_draw to populate them;
         // eng_ector_end uploads and draws them to mask_surface's FBO.
-        {
-           RGBA_Draw_Context *dc = evas_common_draw_context_new();
-           evas_common_draw_context_set_render_op(dc, _EVAS_RENDER_COPY);
-           evas_common_draw_context_set_color(dc, 255, 255, 255, 255);
+        RGBA_Draw_Context *dc = evas_common_draw_context_new();
+        evas_common_draw_context_set_render_op(dc, _EVAS_RENDER_COPY);
+        evas_common_draw_context_set_color(dc, 255, 255, 255, 255);
 
-           if (ENFN->ector_begin(ENC, mask_surface, dc, surface, 0, 0, EINA_FALSE))
-             {
-                _draw_comp(obj, comp_target, surface, engine, output, context);
-                ENFN->image_dirty_region(ENC, mask_surface, 0, 0, size.w, size.h);
-                ENFN->ector_end(ENC, mask_surface, dc, surface, EINA_FALSE);
-             }
+        if (ENFN->ector_begin(ENC, mask_surface, dc, surface, 0, 0, EINA_FALSE))
+          {
+             _draw_comp(obj, comp_target, surface, engine, output, context);
+             ENFN->image_dirty_region(ENC, mask_surface, 0, 0, size.w, size.h);
+             ENFN->ector_end(ENC, mask_surface, dc, surface, EINA_FALSE);
+          }
 
-           evas_common_draw_context_free(dc);
-        }
+        evas_common_draw_context_free(dc);
 
         // Signal to the caller that there is no CPU comp buffer.
         // The mask FBO reference lives on pd->comp.gl_surface; render_pre
@@ -368,16 +366,14 @@ _efl_canvas_vg_container_render_pre(Evas_Object_Protected_Data *vg_pd,
         // inherit the container's opacity.  In the GL span-buffer path,
         // comp is NULL even when a mask FBO was prepared, so also check for
         // gl_surface on the comp_target's pd.
-        {
-           Eina_Bool has_comp = comp != NULL;
-           if (!has_comp && pd->comp_target)
-             {
-                Efl_Canvas_Vg_Container_Data *cpd =
-                   efl_data_scope_get(pd->comp_target, MY_CLASS);
-                if (cpd && cpd->comp.gl_surface) has_comp = EINA_TRUE;
-             }
-           c_a = !has_comp ? 255 : c_a;
-        }
+        Eina_Bool has_comp = comp != NULL;
+        if (!has_comp && pd->comp_target)
+          {
+             Efl_Canvas_Vg_Container_Data *cpd =
+                efl_data_scope_get(pd->comp_target, MY_CLASS);
+             if (cpd && cpd->comp.gl_surface) has_comp = EINA_TRUE;
+          }
+        c_a = !has_comp ? 255 : c_a;
 
         _evas_vg_render_pre(vg_pd, child,
                             engine, output, context, surface,
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c
index a45a1bdd90..2cf80c2a33 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c
@@ -216,6 +216,8 @@ span_collector_free(Span_Collector *sc)
 void
 span_collector_clear(Span_Collector *sc)
 {
+   int i;
+
    if (!sc) return;
 
    // Only zero sc->h rows (the active region), not alloc_h.
@@ -228,29 +230,26 @@ span_collector_clear(Span_Collector *sc)
    //   here so the shader sees len=0 and stops immediately (the rest of the
    //   buffer may retain stale data, but the shader never reaches it)
    // - clear is always called after resize, which has already set height
-   {
-      int i;
-      for (i = 0; i < sc->texture_count; i++)
-        {
-           Span_Texture *tex = &sc->textures[i];
-           int           y;
+   for (i = 0; i < sc->texture_count; i++)
+     {
+        Span_Texture *tex = &sc->textures[i];
+        int           y;
 
-           memset(tex->span_counts, 0, sc->h * sizeof(int));
-           memset(tex->last_x_end, 0, sc->h * sizeof(int));
+        memset(tex->span_counts, 0, sc->h * sizeof(int));
+        memset(tex->last_x_end, 0, sc->h * sizeof(int));
 
-           // Zero byte[1] (len) of entry 0 on every row so that rows
-           // which receive no spans this frame have a valid sentinel.
-           // _collect_spans_solid memsets the full tail for rows it touches,
-           // so this 4-byte-stride write covers only the uncollected rows.
-           for (y = 0; y < sc->h; y++)
-             {
-                tex->buffer[((size_t)y * sc->stride) + 1] = 0;  // byte[1] = len = 0
-             }
+        // Zero byte[1] (len) of entry 0 on every row so that rows
+        // which receive no spans this frame have a valid sentinel.
+        // _collect_spans_solid memsets the full tail for rows it touches,
+        // so this 4-byte-stride write covers only the uncollected rows.
+        for (y = 0; y < sc->h; y++)
+          {
+             tex->buffer[((size_t)y * sc->stride) + 1] = 0;  // byte[1] = len = 0
+          }
 
-           tex->dirty = EINA_FALSE;
-           tex->rolling_hash = 2166136261u;  // seed
-        }
-   }
+        tex->dirty = EINA_FALSE;
+        tex->rolling_hash = 2166136261u;  // seed
+     }
 
    sc->actual_max_spans = 0;
 
@@ -398,6 +397,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
    int           old_ti, split_x, old_x_max, i, y;
    Span_Texture *old_tex;
    Span_Texture *new_tex;
+   Span_Texture *resized;
 
    if (sc->split_count >= SPAN_COLLECTOR_MAX_SPLITS)
      return EINA_FALSE;
@@ -426,13 +426,11 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
 
    // Grow the textures array.  Note: realloc may move it, so re-seat
    // old_tex after the realloc.
-   {
-      Span_Texture *resized = realloc(sc->textures,
-                                      (size_t)(sc->texture_count + 1) *
-                                      sizeof(Span_Texture));
-      if (!resized) return EINA_FALSE;
-      sc->textures = resized;
-   }
+   resized = realloc(sc->textures,
+                     (size_t)(sc->texture_count + 1) *
+                     sizeof(Span_Texture));
+   if (!resized) return EINA_FALSE;
+   sc->textures = resized;
 
    // Initialise the new right-half texture slot in place.
    // Allocate at alloc_h (high-water mark), not the current active
@@ -487,6 +485,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
              int gap = src_entry[2];
              int len = src_entry[1];
              int cov = src_entry[0];
+             int span_end;
              if (len == 0) break;  // sentinel
 
              abs_x += gap;  // start of this span in absolute coords
@@ -498,70 +497,66 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
                   continue;
                }
 
-             {
-                int span_end = abs_x + len;
+             span_end = abs_x + len;
 
-                if (span_end <= split_x)
-                  {
-                     // Entirely in the left half - compact in place.
-                     int new_gap = abs_x - left_last;
-                     left_idx += _emit_gap_extenders(left_row, left_idx,
-                                                     sc->max_spans,
-                                                     sc->stride, &new_gap);
-                     if (left_idx < sc->max_spans)
-                       {
-                          _write_span_entry(left_row + ((size_t)left_idx * 4),
-                                            cov, len, new_gap);
-                          left_idx++;
-                          left_last = span_end;
-                       }
-                  }
-                else if (abs_x >= split_x)
-                  {
-                     // Entirely in the right half - move to new texture.
-                     int new_gap = abs_x - right_last;
-                     right_idx += _emit_gap_extenders(right_row, right_idx,
-                                                      sc->max_spans,
-                                                      sc->stride, &new_gap);
-                     if (right_idx < sc->max_spans)
-                       {
-                          _write_span_entry(right_row + ((size_t)right_idx * 4),
-                                            cov, len, new_gap);
-                          right_idx++;
-                          right_last = span_end;
-                       }
-                  }
-                else
-                  {
-                     // Straddles the split point - divide at split_x.
-                     int left_len  = split_x - abs_x;
-                     int right_len = span_end - split_x;
+             if (span_end <= split_x)
+               {
+                  // Entirely in the left half - compact in place.
+                  int new_gap = abs_x - left_last;
+                  left_idx += _emit_gap_extenders(left_row, left_idx,
+                                                  sc->max_spans,
+                                                  sc->stride, &new_gap);
+                  if (left_idx < sc->max_spans)
+                    {
+                       _write_span_entry(left_row + ((size_t)left_idx * 4),
+                                         cov, len, new_gap);
+                       left_idx++;
+                       left_last = span_end;
+                    }
+               }
+             else if (abs_x >= split_x)
+               {
+                  // Entirely in the right half - move to new texture.
+                  int new_gap = abs_x - right_last;
+                  right_idx += _emit_gap_extenders(right_row, right_idx,
+                                                   sc->max_spans,
+                                                   sc->stride, &new_gap);
+                  if (right_idx < sc->max_spans)
+                    {
+                       _write_span_entry(right_row + ((size_t)right_idx * 4),
+                                         cov, len, new_gap);
+                       right_idx++;
+                       right_last = span_end;
+                    }
+               }
+             else
+               {
+                  // Straddles the split point - divide at split_x.
+                  int left_len  = split_x - abs_x;
+                  int right_len = span_end - split_x;
+                  int new_gap   = abs_x - left_last;
 
-                     // Left fragment.
-                     {
-                        int new_gap = abs_x - left_last;
-                        left_idx += _emit_gap_extenders(left_row, left_idx,
-                                                        sc->max_spans,
-                                                        sc->stride, &new_gap);
-                        if (left_idx < sc->max_spans)
-                          {
-                             _write_span_entry(left_row + ((size_t)left_idx * 4),
-                                               cov, left_len, new_gap);
-                             left_idx++;
-                             left_last = split_x;
-                          }
-                     }
+                  // Left fragment.
+                  left_idx += _emit_gap_extenders(left_row, left_idx,
+                                                  sc->max_spans,
+                                                  sc->stride, &new_gap);
+                  if (left_idx < sc->max_spans)
+                    {
+                       _write_span_entry(left_row + ((size_t)left_idx * 4),
+                                         cov, left_len, new_gap);
+                       left_idx++;
+                       left_last = split_x;
+                    }
 
-                     // Right fragment starts exactly at split_x -> gap = 0.
-                     if (right_idx < sc->max_spans)
-                       {
-                          _write_span_entry(right_row + ((size_t)right_idx * 4),
-                                            cov, right_len, 0);
-                          right_idx++;
-                          right_last = span_end;
-                       }
-                  }
-             }
+                  // Right fragment starts exactly at split_x -> gap = 0.
+                  if (right_idx < sc->max_spans)
+                    {
+                       _write_span_entry(right_row + ((size_t)right_idx * 4),
+                                         cov, right_len, 0);
+                       right_idx++;
+                       right_last = span_end;
+                    }
+               }
 
              abs_x += len;  // advance past this span
           }
@@ -684,6 +679,8 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
    Span_Data      *sd  = (Span_Data *)user_data;
    Span_Collector *sc  = (Span_Collector *)sd->span_collector;
    int             ti, idx, y, sx;
+   int             ref, gap, remaining, cur_x;
+   unsigned int    cov;
    Span_Texture   *tex;
    uint8_t        *entry;
 
@@ -746,77 +743,74 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
              continue;
           }
 
-        {
-           // 1-texel (4-byte) packing in BGRA-swapped order so the buffer
-           // can be uploaded directly via GL_BGRA without a staging copy.
-           //
-           // Memory layout: [cov, len, gap, reserved]
-           // GL_BGRA interprets: B=cov, G=len, R=gap, A=reserved
-           // Shader reads: .r=gap, .g=len, .b=cov - correct.
-           //
-           // gap = distance from end of previous span on this row.
-           // Spans longer than 255 are split into multiple entries.
+        // 1-texel (4-byte) packing in BGRA-swapped order so the buffer
+        // can be uploaded directly via GL_BGRA without a staging copy.
+        //
+        // Memory layout: [cov, len, gap, reserved]
+        // GL_BGRA interprets: B=cov, G=len, R=gap, A=reserved
+        // Shader reads: .r=gap, .g=len, .b=cov - correct.
+        //
+        // gap = distance from end of previous span on this row.
+        // Spans longer than 255 are split into multiple entries.
 
-           // Compute gap relative to x_min so split textures don't
-           // overflow the 8-bit gap field.  The shader adds x_min to
-           // its sx accumulator to recover absolute coordinates.
-           int ref = (tex->last_x_end[y] > tex->x_min)
-                   ? tex->last_x_end[y] : tex->x_min;
-           int gap = sx - ref;
-           int remaining = spans->len;
-           unsigned int cov = spans->coverage;
-           int cur_x = sx;
+        // Compute gap relative to x_min so split textures don't
+        // overflow the 8-bit gap field.  The shader adds x_min to
+        // its sx accumulator to recover absolute coordinates.
+        ref = (tex->last_x_end[y] > tex->x_min)
+            ? tex->last_x_end[y] : tex->x_min;
+        gap = sx - ref;
+        remaining = spans->len;
+        cov = spans->coverage;
+        cur_x = sx;
 
-           tex->dirty = EINA_TRUE;
+        tex->dirty = EINA_TRUE;
 
-           if (gap < 0) gap = 0;
+        if (gap < 0) gap = 0;
 
-           // When the gap exceeds 255, emit invisible "gap extender"
-           // entries (coverage=0, len=1) that advance the shader's x
-           // accumulator by 256 per entry without drawing anything.
-           // This preserves absolute x positioning for wide VG objects
-           // where spans can be hundreds of pixels apart.
-           while ((gap > 255) && (idx < sc->max_spans))
-             {
-                entry = tex->buffer + ((size_t)y * sc->stride) + ((size_t)idx * 4);
-                entry[0] = 0;              // cov = 0 -> invisible
-                entry[1] = 1;              // len = 1 -> advances x by 1
-                entry[2] = 255;            // gap = 255 -> advances x by 255
-                entry[3] = 0;
-                tex->rolling_hash = (tex->rolling_hash * 31) + *((const uint32_t *)entry);
-                gap -= 256;                // 255 gap + 1 len = 256 pixels
-                idx++;
-             }
+        // When the gap exceeds 255, emit invisible "gap extender"
+        // entries (coverage=0, len=1) that advance the shader's x
+        // accumulator by 256 per entry without drawing anything.
+        // This preserves absolute x positioning for wide VG objects
+        // where spans can be hundreds of pixels apart.
+        while ((gap > 255) && (idx < sc->max_spans))
+          {
+             entry = tex->buffer + ((size_t)y * sc->stride) + ((size_t)idx * 4);
+             entry[0] = 0;              // cov = 0 -> invisible
+             entry[1] = 1;              // len = 1 -> advances x by 1
+             entry[2] = 255;            // gap = 255 -> advances x by 255
+             entry[3] = 0;
+             tex->rolling_hash = (tex->rolling_hash * 31) + *((const uint32_t *)entry);
+             gap -= 256;                // 255 gap + 1 len = 256 pixels
+             idx++;
+          }
 
-           while ((remaining > 0) && (idx < sc->max_spans))
-             {
-                int chunk = (remaining > 255) ? 255 : remaining;
-                int g = (cur_x == sx) ? gap : 0;
-                if (g > 255) g = 255;
+        while ((remaining > 0) && (idx < sc->max_spans))
+          {
+             int chunk = (remaining > 255) ? 255 : remaining;
+             int g = (cur_x == sx) ? gap : 0;
+             uint32_t v;
 
-                // Compose once, then hash the value rather than reading
-                // back the bytes just stored - that read waits on the
-                // stores in the innermost loop of the collector.
-                {
-                   uint32_t v = (uint32_t)cov
-                              | ((uint32_t)chunk << 8)
-                              | ((uint32_t)g     << 16);
+             if (g > 255) g = 255;
 
-                   entry = tex->buffer + ((size_t)y * sc->stride) + ((size_t)idx * 4);
-                   entry[0] = (uint8_t)cov;    // byte0 -> B in BGRA
-                   entry[1] = (uint8_t)chunk;  // byte1 -> G in BGRA
-                   entry[2] = (uint8_t)g;      // byte2 -> R in BGRA
-                   entry[3] = 0;               // byte3 -> A in BGRA
-                   tex->rolling_hash = (tex->rolling_hash * 31) + v;
-                }
+             // Compose once, then hash the value rather than reading
+             // back the bytes just stored - that read waits on the
+             // stores in the innermost loop of the collector.
+             v = (uint32_t)cov
+                 | ((uint32_t)chunk << 8)
+                 | ((uint32_t)g     << 16);
+             entry = tex->buffer + ((size_t)y * sc->stride) + ((size_t)idx * 4);
+             entry[0] = (uint8_t)cov;    // byte0 -> B in BGRA
+             entry[1] = (uint8_t)chunk;  // byte1 -> G in BGRA
+             entry[2] = (uint8_t)g;      // byte2 -> R in BGRA
+             entry[3] = 0;               // byte3 -> A in BGRA
+             tex->rolling_hash = (tex->rolling_hash * 31) + v;
 
-                cur_x += chunk;
-                remaining -= chunk;
-                idx++;
-             }
+             cur_x += chunk;
+             remaining -= chunk;
+             idx++;
+          }
 
-           tex->last_x_end[y] = sx + spans->len;
-        }
+        tex->last_x_end[y] = sx + spans->len;
 
         tex->span_counts[y] = idx;
         if (idx > sc->actual_max_spans)
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
index bbbee6ea18..868336f6e6 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
@@ -691,6 +691,7 @@ static const char **
 _span_shader_parts_build(int kind, Span_Bind_Set bind, int mask, int *out_count)
 {
    const char *parts[20];
+   const char **out;
    int n = 0;
 
    parts[n++] = _span_fragment_highp_supported() ? _glsl_hp_highp : _glsl_hp_mediump;
@@ -713,17 +714,15 @@ _span_shader_parts_build(int kind, Span_Bind_Set bind, int mask, int *out_count)
    if (mask) parts[n++] = _glsl_mask_epilogue;
    parts[n++] = _glsl_main_end;
 
-   {
-      const char **out = malloc(sizeof(*out) * (size_t)n);
-      if (!out)
-        {
-           *out_count = 0;
-           return NULL;
-        }
-      memcpy(out, parts, sizeof(*out) * (size_t)n);
-      *out_count = n;
-      return out;
-   }
+   out = malloc(sizeof(*out) * (size_t)n);
+   if (!out)
+     {
+        *out_count = 0;
+        return NULL;
+     }
+   memcpy(out, parts, sizeof(*out) * (size_t)n);
+   *out_count = n;
+   return out;
 }
 
 // Build vertex-shader source parts for the (kind, mask) combination.
@@ -733,6 +732,7 @@ static const char **
 _span_vs_parts_build(int kind, int mask, int *out_count)
 {
    const char *parts[13];
+   const char **out;
    int n = 0;
 
    parts[n++] = _span_fragment_highp_supported() ? _glsl_hp_highp : _glsl_hp_mediump;
@@ -753,17 +753,15 @@ _span_vs_parts_build(int kind, int mask, int *out_count)
    else
      parts[n++] = mask ? _glsl_vs_main_gradient_mask : _glsl_vs_main_gradient;
 
-   {
-      const char **out = malloc(sizeof(*out) * (size_t)n);
-      if (!out)
-        {
-           *out_count = 0;
-           return NULL;
-        }
-      memcpy(out, parts, sizeof(*out) * (size_t)n);
-      *out_count = n;
-      return out;
-   }
+   out = malloc(sizeof(*out) * (size_t)n);
+   if (!out)
+     {
+        *out_count = 0;
+        return NULL;
+     }
+   memcpy(out, parts, sizeof(*out) * (size_t)n);
+   *out_count = n;
+   return out;
 }
 
 // ------------------------------------------------------------------
diff --git a/src/tests/ector/suite/ector_test_span_collector.c b/src/tests/ector/suite/ector_test_span_collector.c
index 8c6c4222b7..1df04438c1 100644
--- a/src/tests/ector/suite/ector_test_span_collector.c
+++ b/src/tests/ector/suite/ector_test_span_collector.c
@@ -396,6 +396,8 @@ EFL_START_TEST(span_collector_overflow_split)
    int             i, total;
    int             rx[16], rl[16], rcount, all_count;
    int             found[5];
+   int             orig_x[5] = {10, 30, 60, 90, 120};
+   int             j, k;
 
    sc = span_collector_new(10, 4, Solid);
    ck_assert_ptr_nonnull(sc);
@@ -451,21 +453,17 @@ EFL_START_TEST(span_collector_overflow_split)
 
    // Every original x must appear in the reconstructed list.
    memset(found, 0, sizeof(found));
-   {
-      int orig_x[5] = {10, 30, 60, 90, 120};
-      int j, k;
-      for (j = 0; j < 5; j++)
-        {
-           for (k = 0; k < all_count; k++)
-             {
-                if ((rx[k] == orig_x[j]) && (rl[k] == 5))
-                  {
-                     found[j] = 1;
-                     break;
-                  }
-             }
-        }
-   }
+   for (j = 0; j < 5; j++)
+     {
+        for (k = 0; k < all_count; k++)
+          {
+             if ((rx[k] == orig_x[j]) && (rl[k] == 5))
+               {
+                  found[j] = 1;
+                  break;
+               }
+          }
+     }
    for (i = 0; i < 5; i++)
      {
         ck_assert_int_eq(found[i], 1);
@@ -498,6 +496,7 @@ EFL_START_TEST(span_collector_split_absolute_x)
    int             rx[16], rl[16];
    int             found[5];
    int             orig_x[5] = {10, 40, 80, 130, 180};
+   int             j, k;
 
    sc = span_collector_new(10, 4, Solid);
    ck_assert_ptr_nonnull(sc);
@@ -529,20 +528,17 @@ EFL_START_TEST(span_collector_split_absolute_x)
 
    // Every original span must be present at the correct absolute x.
    memset(found, 0, sizeof(found));
-   {
-      int j, k;
-      for (j = 0; j < 5; j++)
-        {
-           for (k = 0; k < all_count; k++)
-             {
-                if ((rx[k] == orig_x[j]) && (rl[k] == 5))
-                  {
-                     found[j] = 1;
-                     break;
-                  }
-             }
-        }
-   }
+   for (j = 0; j < 5; j++)
+     {
+        for (k = 0; k < all_count; k++)
+          {
+             if ((rx[k] == orig_x[j]) && (rl[k] == 5))
+               {
+                  found[j] = 1;
+                  break;
+               }
+          }
+     }
    for (i = 0; i < 5; i++)
      {
         // Use ck_assert_msg so failures name the offending original x.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to