LCOV - differential code coverage report
Current view: top level - contrib/ltree_plpython - ltree_plpython.c (source / functions) Coverage Total Hit UBC CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 94.1 % 17 16 1 16
Current Date: 2025-09-06 07:49:51 +0900 Functions: 100.0 % 4 4 4
Baseline: lcov-20250906-005545-baseline Branches: 50.0 % 8 4 4 4
Baseline Date: 2025-09-05 08:21:35 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(30,360] days: 100.0 % 1 1 1
(360..) days: 93.8 % 16 15 1 15
Function coverage date bins:
(30,360] days: 100.0 % 1 1 1
(360..) days: 100.0 % 3 3 3
Branch coverage date bins:
(360..) days: 50.0 % 8 4 4 4

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : #include "postgres.h"
                                  2                 :                : 
                                  3                 :                : #include "fmgr.h"
                                  4                 :                : #include "ltree/ltree.h"
                                  5                 :                : #include "plpy_util.h"
                                  6                 :                : 
  164 tgl@sss.pgh.pa.us           7                 :CBC           1 : PG_MODULE_MAGIC_EXT(
                                  8                 :                :                     .name = "ltree_plpython",
                                  9                 :                :                     .version = PG_VERSION
                                 10                 :                : );
                                 11                 :                : 
                                 12                 :                : /* Linkage to functions in plpython module */
                                 13                 :                : typedef PyObject *(*PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size);
                                 14                 :                : static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p;
                                 15                 :                : 
                                 16                 :                : 
                                 17                 :                : /*
                                 18                 :                :  * Module initialize function: fetch function pointers for cross-module calls.
                                 19                 :                :  */
                                 20                 :                : void
 3259                            21                 :              1 : _PG_init(void)
                                 22                 :                : {
                                 23                 :                :     /* Asserts verify that typedefs above match original declarations */
                                 24                 :                :     AssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t);
                                 25                 :              1 :     PLyUnicode_FromStringAndSize_p = (PLyUnicode_FromStringAndSize_t)
                                 26                 :              1 :         load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize",
                                 27                 :                :                                true, NULL);
                                 28                 :              1 : }
                                 29                 :                : 
                                 30                 :                : 
                                 31                 :                : /* These defines must be after the module init function */
                                 32                 :                : #define PLyUnicode_FromStringAndSize PLyUnicode_FromStringAndSize_p
                                 33                 :                : 
                                 34                 :                : 
 3786 peter_e@gmx.net            35                 :              2 : PG_FUNCTION_INFO_V1(ltree_to_plpython);
                                 36                 :                : 
                                 37                 :                : Datum
                                 38                 :              2 : ltree_to_plpython(PG_FUNCTION_ARGS)
                                 39                 :                : {
 2910 tgl@sss.pgh.pa.us          40                 :              2 :     ltree      *in = PG_GETARG_LTREE_P(0);
                                 41                 :                :     int         i;
                                 42                 :                :     PyObject   *list;
                                 43                 :                :     ltree_level *curlevel;
                                 44                 :                : 
 3786 peter_e@gmx.net            45                 :              2 :     list = PyList_New(in->numlevel);
 2867                            46         [ -  + ]:              2 :     if (!list)
 2867 peter_e@gmx.net            47         [ #  # ]:UBC           0 :         ereport(ERROR,
                                 48                 :                :                 (errcode(ERRCODE_OUT_OF_MEMORY),
                                 49                 :                :                  errmsg("out of memory")));
                                 50                 :                : 
 3786 peter_e@gmx.net            51                 :CBC           2 :     curlevel = LTREE_FIRST(in);
                                 52         [ +  + ]:              8 :     for (i = 0; i < in->numlevel; i++)
                                 53                 :                :     {
 1279 andres@anarazel.de         54                 :              6 :         PyList_SetItem(list, i, PLyUnicode_FromStringAndSize(curlevel->name, curlevel->len));
 3786 peter_e@gmx.net            55                 :              6 :         curlevel = LEVEL_NEXT(curlevel);
                                 56                 :                :     }
                                 57                 :                : 
                                 58         [ -  + ]:              2 :     PG_FREE_IF_COPY(in, 0);
                                 59                 :                : 
                                 60                 :              2 :     return PointerGetDatum(list);
                                 61                 :                : }
        

Generated by: LCOV version 2.4-beta