LCOV - differential code coverage report
Current view: top level - src/common - config_info.c (source / functions) Coverage Total Hit GNC CBC DCB
Current: Differential Code Coverage HEAD vs 15 Lines: 100.0 % 105 105 1 104 1
Current Date: 2023-04-08 17:13:01 Functions: 100.0 % 1 1 1
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (180,240] days: 100.0 % 1 1 1
Legend: Lines: hit not hit (240..) days: 100.0 % 104 104 104
Function coverage date bins:
(240..) days: 100.0 % 1 1 1

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  * config_info.c
                                  4                 :  *      Common code for pg_config output
                                  5                 :  *
                                  6                 :  *
                                  7                 :  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
                                  8                 :  * Portions Copyright (c) 1994, Regents of the University of California
                                  9                 :  *
                                 10                 :  *
                                 11                 :  * IDENTIFICATION
                                 12                 :  *    src/common/config_info.c
                                 13                 :  *
                                 14                 :  *-------------------------------------------------------------------------
                                 15                 :  */
                                 16                 : 
                                 17                 : #ifndef FRONTEND
                                 18                 : #include "postgres.h"
                                 19                 : #else
                                 20                 : #include "postgres_fe.h"
                                 21                 : #endif
                                 22                 : 
                                 23                 : #include "common/config_info.h"
                                 24                 : 
                                 25                 : 
                                 26                 : /*
                                 27                 :  * get_configdata(const char *my_exec_path, size_t *configdata_len)
                                 28                 :  *
                                 29                 :  * Get configure-time constants. The caller is responsible
                                 30                 :  * for pfreeing the result.
                                 31                 :  */
                                 32                 : ConfigData *
 2604 tgl                        33 CBC         332 : get_configdata(const char *my_exec_path, size_t *configdata_len)
                                 34                 : {
                                 35                 :     ConfigData *configdata;
                                 36                 :     char        path[MAXPGPATH];
                                 37                 :     char       *lastsep;
 2495 rhaas                      38             332 :     int         i = 0;
                                 39                 : 
                                 40                 :     /* Adjust this to match the number of items filled below */
 2604 tgl                        41             332 :     *configdata_len = 23;
  209 peter                      42 GNC         332 :     configdata = palloc_array(ConfigData, *configdata_len);
                                 43                 : 
 2604 tgl                        44 CBC         332 :     configdata[i].name = pstrdup("BINDIR");
                                 45             332 :     strlcpy(path, my_exec_path, sizeof(path));
 2608 mail                       46             332 :     lastsep = strrchr(path, '/');
                                 47             332 :     if (lastsep)
                                 48             332 :         *lastsep = '\0';
                                 49             332 :     cleanup_path(path);
 2604 tgl                        50             332 :     configdata[i].setting = pstrdup(path);
                                 51             332 :     i++;
                                 52                 : 
                                 53             332 :     configdata[i].name = pstrdup("DOCDIR");
 2608 mail                       54             332 :     get_doc_path(my_exec_path, path);
                                 55             332 :     cleanup_path(path);
 2604 tgl                        56             332 :     configdata[i].setting = pstrdup(path);
                                 57             332 :     i++;
                                 58                 : 
                                 59             332 :     configdata[i].name = pstrdup("HTMLDIR");
 2608 mail                       60             332 :     get_html_path(my_exec_path, path);
                                 61             332 :     cleanup_path(path);
 2604 tgl                        62             332 :     configdata[i].setting = pstrdup(path);
                                 63             332 :     i++;
                                 64                 : 
                                 65             332 :     configdata[i].name = pstrdup("INCLUDEDIR");
 2608 mail                       66             332 :     get_include_path(my_exec_path, path);
                                 67             332 :     cleanup_path(path);
 2604 tgl                        68             332 :     configdata[i].setting = pstrdup(path);
                                 69             332 :     i++;
                                 70                 : 
                                 71             332 :     configdata[i].name = pstrdup("PKGINCLUDEDIR");
 2608 mail                       72             332 :     get_pkginclude_path(my_exec_path, path);
                                 73             332 :     cleanup_path(path);
 2604 tgl                        74             332 :     configdata[i].setting = pstrdup(path);
                                 75             332 :     i++;
                                 76                 : 
                                 77             332 :     configdata[i].name = pstrdup("INCLUDEDIR-SERVER");
 2608 mail                       78             332 :     get_includeserver_path(my_exec_path, path);
                                 79             332 :     cleanup_path(path);
 2604 tgl                        80             332 :     configdata[i].setting = pstrdup(path);
                                 81             332 :     i++;
                                 82                 : 
                                 83             332 :     configdata[i].name = pstrdup("LIBDIR");
 2608 mail                       84             332 :     get_lib_path(my_exec_path, path);
                                 85             332 :     cleanup_path(path);
 2604 tgl                        86             332 :     configdata[i].setting = pstrdup(path);
                                 87             332 :     i++;
                                 88                 : 
                                 89             332 :     configdata[i].name = pstrdup("PKGLIBDIR");
 2608 mail                       90             332 :     get_pkglib_path(my_exec_path, path);
                                 91             332 :     cleanup_path(path);
 2604 tgl                        92             332 :     configdata[i].setting = pstrdup(path);
                                 93             332 :     i++;
                                 94                 : 
                                 95             332 :     configdata[i].name = pstrdup("LOCALEDIR");
 2608 mail                       96             332 :     get_locale_path(my_exec_path, path);
                                 97             332 :     cleanup_path(path);
 2604 tgl                        98             332 :     configdata[i].setting = pstrdup(path);
                                 99             332 :     i++;
                                100                 : 
                                101             332 :     configdata[i].name = pstrdup("MANDIR");
 2608 mail                      102             332 :     get_man_path(my_exec_path, path);
                                103             332 :     cleanup_path(path);
 2604 tgl                       104             332 :     configdata[i].setting = pstrdup(path);
                                105             332 :     i++;
                                106                 : 
                                107             332 :     configdata[i].name = pstrdup("SHAREDIR");
 2608 mail                      108             332 :     get_share_path(my_exec_path, path);
                                109             332 :     cleanup_path(path);
 2604 tgl                       110             332 :     configdata[i].setting = pstrdup(path);
                                111             332 :     i++;
                                112                 : 
                                113             332 :     configdata[i].name = pstrdup("SYSCONFDIR");
 2608 mail                      114             332 :     get_etc_path(my_exec_path, path);
                                115             332 :     cleanup_path(path);
 2604 tgl                       116             332 :     configdata[i].setting = pstrdup(path);
                                117             332 :     i++;
                                118                 : 
                                119             332 :     configdata[i].name = pstrdup("PGXS");
 2608 mail                      120             332 :     get_pkglib_path(my_exec_path, path);
                                121             332 :     strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
                                122             332 :     cleanup_path(path);
 2604 tgl                       123             332 :     configdata[i].setting = pstrdup(path);
                                124             332 :     i++;
                                125                 : 
                                126             332 :     configdata[i].name = pstrdup("CONFIGURE");
 1154 peter                     127             332 :     configdata[i].setting = pstrdup(CONFIGURE_ARGS);
 2604 tgl                       128             332 :     i++;
                                129                 : 
                                130             332 :     configdata[i].name = pstrdup("CC");
                                131                 : #ifdef VAL_CC
                                132             332 :     configdata[i].setting = pstrdup(VAL_CC);
                                133                 : #else
                                134                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                135                 : #endif
                                136             332 :     i++;
                                137                 : 
                                138             332 :     configdata[i].name = pstrdup("CPPFLAGS");
                                139                 : #ifdef VAL_CPPFLAGS
                                140             332 :     configdata[i].setting = pstrdup(VAL_CPPFLAGS);
                                141                 : #else
                                142                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                143                 : #endif
                                144             332 :     i++;
                                145                 : 
                                146             332 :     configdata[i].name = pstrdup("CFLAGS");
                                147                 : #ifdef VAL_CFLAGS
                                148             332 :     configdata[i].setting = pstrdup(VAL_CFLAGS);
                                149                 : #else
                                150                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                151                 : #endif
                                152             332 :     i++;
                                153                 : 
                                154             332 :     configdata[i].name = pstrdup("CFLAGS_SL");
                                155                 : #ifdef VAL_CFLAGS_SL
                                156             332 :     configdata[i].setting = pstrdup(VAL_CFLAGS_SL);
                                157                 : #else
                                158                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                159                 : #endif
                                160             332 :     i++;
                                161                 : 
                                162             332 :     configdata[i].name = pstrdup("LDFLAGS");
                                163                 : #ifdef VAL_LDFLAGS
                                164             332 :     configdata[i].setting = pstrdup(VAL_LDFLAGS);
                                165                 : #else
                                166                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                167                 : #endif
                                168             332 :     i++;
                                169                 : 
                                170             332 :     configdata[i].name = pstrdup("LDFLAGS_EX");
                                171                 : #ifdef VAL_LDFLAGS_EX
                                172             332 :     configdata[i].setting = pstrdup(VAL_LDFLAGS_EX);
                                173                 : #else
                                174                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                175                 : #endif
                                176             332 :     i++;
                                177                 : 
                                178             332 :     configdata[i].name = pstrdup("LDFLAGS_SL");
                                179                 : #ifdef VAL_LDFLAGS_SL
                                180             332 :     configdata[i].setting = pstrdup(VAL_LDFLAGS_SL);
                                181                 : #else
                                182                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                183                 : #endif
                                184             332 :     i++;
                                185                 : 
                                186             332 :     configdata[i].name = pstrdup("LIBS");
                                187                 : #ifdef VAL_LIBS
                                188             332 :     configdata[i].setting = pstrdup(VAL_LIBS);
                                189                 : #else
                                190                 :     configdata[i].setting = pstrdup(_("not recorded"));
                                191                 : #endif
                                192             332 :     i++;
                                193                 : 
                                194             332 :     configdata[i].name = pstrdup("VERSION");
                                195             332 :     configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION);
                                196             332 :     i++;
                                197                 : 
                                198             332 :     Assert(i == *configdata_len);
                                199                 : 
 2608 mail                      200             332 :     return configdata;
                                201                 : }
        

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