LCOV - code coverage report
Current view: top level - libs/mem/src - mem_concat_cstring.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 80.0 % 10 8
Test Date: 2026-03-01 04:31:48 Functions: 100.0 % 1 1
Branches: 50.0 % 14 7

             Branch data     Line data    Source code
       1                 :             : #include "mem.h"
       2                 :             : 
       3                 :             : /**
       4                 :             :  * @brief Concatenate visible bytes from a bounded source string buffer.
       5                 :             :  *
       6                 :             :  * The source buffer is normalized into a temporary descriptor with
       7                 :             :  * @ref memory_copy_cstring and then appended through @ref memory_concat_strings.
       8                 :             :  */
       9                 :          18 : Return memory_concat_cstring(
      10                 :             :         memory     *destination,
      11                 :             :         const char *source_buffer,
      12                 :             :         size_t     source_buffer_size)
      13                 :             : {
      14                 :             :         /* Status returned by this function through provide()
      15                 :             :            Default value assumes successful completion */
      16                 :          18 :         Return status = SUCCESS;
      17                 :             : 
      18                 :          18 :         create(char,source_view);
      19                 :             : 
      20         [ -  + ]:          18 :         if(destination == NULL)
      21                 :             :         {
      22                 :           0 :                 report("Memory management; concat_cstring destination must be non-NULL");
      23                 :           0 :                 status = FAILURE;
      24                 :             :         }
      25                 :             : 
      26   [ +  -  -  + ]:          18 :         run(copy_cstring(source_view,source_buffer,source_buffer_size));
      27                 :             : 
      28   [ +  -  -  + ]:          18 :         run(concat_strings(destination,source_view));
      29                 :             : 
      30   [ -  +  -  + ]:          18 :         call(del(source_view));
      31                 :             : 
      32                 :          18 :         provide(status);
      33                 :             : }
        

Generated by: LCOV version 2.0-1