LCOV - code coverage report
Current view: top level - drivers/net/ntnic/ntlog - ntlog.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 15 0.0 %
Date: 2025-12-01 19:08:10 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 6 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2023 Napatech A/S
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "ntlog.h"
       6                 :            : 
       7                 :            : #include <stdarg.h>
       8                 :            : #include <stddef.h>
       9                 :            : #include <string.h>
      10                 :            : #include <stdlib.h>
      11                 :            : #include <stdbool.h>
      12                 :            : 
      13                 :            : #include <rte_log.h>
      14                 :            : #include <rte_string_fns.h>
      15                 :            : 
      16                 :            : #define NTLOG_HELPER_STR_SIZE_MAX (1024)
      17                 :            : 
      18                 :          0 : char *nthw_log_helper_str_alloc(const char *sinit)
      19                 :            : {
      20                 :          0 :         char *s = malloc(NTLOG_HELPER_STR_SIZE_MAX);
      21                 :            : 
      22         [ #  # ]:          0 :         if (!s)
      23                 :            :                 return NULL;
      24                 :            : 
      25         [ #  # ]:          0 :         if (sinit)
      26                 :            :                 snprintf(s, NTLOG_HELPER_STR_SIZE_MAX, "%s", sinit);
      27                 :            : 
      28                 :            :         else
      29                 :          0 :                 s[0] = '\0';
      30                 :            : 
      31                 :            :         return s;
      32                 :            : }
      33                 :            : 
      34                 :            : __rte_format_printf(2, 0)
      35                 :          0 : void nthw_log_helper_str_add(char *s, const char *format, ...)
      36                 :            : {
      37         [ #  # ]:          0 :         if (!s)
      38                 :          0 :                 return;
      39                 :            : 
      40                 :            :         va_list args;
      41                 :          0 :         va_start(args, format);
      42                 :          0 :         int len = strlen(s);
      43                 :          0 :         vsnprintf(&s[len], (NTLOG_HELPER_STR_SIZE_MAX - 1 - len), format, args);
      44                 :          0 :         va_end(args);
      45                 :            : }
      46                 :            : 
      47                 :          0 : void nthw_log_helper_str_free(char *s)
      48                 :            : {
      49                 :          0 :         free(s);
      50                 :          0 : }

Generated by: LCOV version 1.14