LCOV - differential code coverage report
Current view: top level - src/backend/snowball/libstemmer - api.c (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage HEAD vs 15 Lines: 45.2 % 31 14 17 14
Current Date: 2023-04-08 15:15:32 Functions: 66.7 % 3 2 1 2
Baseline: 15
Baseline Date: 2023-04-08 15:09:40
Legend: Lines: hit not hit

           TLA  Line data    Source code
       1                 : #include "header.h"
       2                 : 
       3 CBC          19 : extern struct SN_env * SN_create_env(int S_size, int I_size)
       4                 : {
       5              19 :     struct SN_env * z = (struct SN_env *) calloc(1, sizeof(struct SN_env));
       6              19 :     if (z == NULL) return NULL;
       7              19 :     z->p = create_s();
       8              19 :     if (z->p == NULL) goto error;
       9              19 :     if (S_size)
      10                 :     {
      11                 :         int i;
      12 UBC           0 :         z->S = (symbol * *) calloc(S_size, sizeof(symbol *));
      13               0 :         if (z->S == NULL) goto error;
      14                 : 
      15               0 :         for (i = 0; i < S_size; i++)
      16                 :         {
      17               0 :             z->S[i] = create_s();
      18               0 :             if (z->S[i] == NULL) goto error;
      19                 :         }
      20                 :     }
      21                 : 
      22 CBC          19 :     if (I_size)
      23                 :     {
      24              19 :         z->I = (int *) calloc(I_size, sizeof(int));
      25              19 :         if (z->I == NULL) goto error;
      26                 :     }
      27                 : 
      28              19 :     return z;
      29 UBC           0 : error:
      30               0 :     SN_close_env(z, S_size);
      31               0 :     return NULL;
      32                 : }
      33                 : 
      34               0 : extern void SN_close_env(struct SN_env * z, int S_size)
      35                 : {
      36               0 :     if (z == NULL) return;
      37               0 :     if (S_size)
      38                 :     {
      39                 :         int i;
      40               0 :         for (i = 0; i < S_size; i++)
      41                 :         {
      42               0 :             lose_s(z->S[i]);
      43                 :         }
      44               0 :         free(z->S);
      45                 :     }
      46               0 :     free(z->I);
      47               0 :     if (z->p) lose_s(z->p);
      48               0 :     free(z);
      49                 : }
      50                 : 
      51 CBC        3401 : extern int SN_set_current(struct SN_env * z, int size, const symbol * s)
      52                 : {
      53            3401 :     int err = replace_s(z, 0, z->l, size, s, NULL);
      54            3401 :     z->c = 0;
      55            3401 :     return err;
      56                 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a