LCOV - code coverage report
Current view: top level - src/backend/access/rmgrdesc - rmgrdesc_utils.c (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 75.0 % 20 15
Test Date: 2026-07-12 09:15:39 Functions: 75.0 % 4 3
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 83.3 % 6 5

             Branch data     Line data    Source code
       1                 :             : /*-------------------------------------------------------------------------
       2                 :             :  *
       3                 :             :  * rmgrdesc_utils.c
       4                 :             :  *    Support functions for rmgrdesc routines
       5                 :             :  *
       6                 :             :  * Copyright (c) 2023-2026, PostgreSQL Global Development Group
       7                 :             :  *
       8                 :             :  *
       9                 :             :  * IDENTIFICATION
      10                 :             :  *    src/backend/access/rmgrdesc/rmgrdesc_utils.c
      11                 :             :  *
      12                 :             :  *-------------------------------------------------------------------------
      13                 :             :  */
      14                 :             : #include "postgres.h"
      15                 :             : 
      16                 :             : #include "access/rmgrdesc_utils.h"
      17                 :             : #include "storage/off.h"
      18                 :             : 
      19                 :             : /*
      20                 :             :  * Helper function to print an array, in the format described in the
      21                 :             :  * README.
      22                 :             :  */
      23                 :             : void
      24                 :          69 : array_desc(StringInfo buf, void *array, size_t elem_size, int count,
      25                 :             :            void (*elem_desc) (StringInfo buf, void *elem, void *data),
      26                 :             :            void *data)
      27                 :             : {
      28         [ -  + ]:          69 :     if (count == 0)
      29                 :             :     {
      30                 :           0 :         appendStringInfoString(buf, " []");
      31                 :           0 :         return;
      32                 :             :     }
      33                 :          69 :     appendStringInfoString(buf, " [");
      34         [ +  + ]:         470 :     for (int i = 0; i < count; i++)
      35                 :             :     {
      36                 :         401 :         elem_desc(buf, (char *) array + elem_size * i, data);
      37         [ +  + ]:         401 :         if (i < count - 1)
      38                 :         332 :             appendStringInfoString(buf, ", ");
      39                 :             :     }
      40                 :          69 :     appendStringInfoChar(buf, ']');
      41                 :             : }
      42                 :             : 
      43                 :             : void
      44                 :         350 : offset_elem_desc(StringInfo buf, void *offset, void *data)
      45                 :             : {
      46                 :         350 :     appendStringInfo(buf, "%u", *(OffsetNumber *) offset);
      47                 :         350 : }
      48                 :             : 
      49                 :             : void
      50                 :          43 : redirect_elem_desc(StringInfo buf, void *offset, void *data)
      51                 :             : {
      52                 :          43 :     OffsetNumber *new_offset = (OffsetNumber *) offset;
      53                 :             : 
      54                 :          43 :     appendStringInfo(buf, "%u->%u", new_offset[0], new_offset[1]);
      55                 :          43 : }
      56                 :             : 
      57                 :             : void
      58                 :           0 : oid_elem_desc(StringInfo buf, void *relid, void *data)
      59                 :             : {
      60                 :           0 :     appendStringInfo(buf, "%u", *(Oid *) relid);
      61                 :           0 : }
        

Generated by: LCOV version 2.0-1