Coverage Report

Created: 2026-02-14 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/glib/gmodule/gmodule-deprecated.c
Line
Count
Source
1
#include "config.h"
2
3
/* 
4
 * This is the only way to disable deprecation warnings for macros, and we need
5
 * to continue using G_MODULE_SUFFIX in the implementation of
6
 * g_module_build_path() which is also deprecated API.
7
 */
8
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
9
#define GLIB_DISABLE_DEPRECATION_WARNINGS
10
#endif
11
12
#include <glib.h>
13
14
#include <stdbool.h>
15
16
#if (G_MODULE_IMPL == G_MODULE_IMPL_AR) || (G_MODULE_IMPL == G_MODULE_IMPL_DL)
17
G_GNUC_INTERNAL gchar*    _g_module_build_path (const gchar *directory,
18
                                                const gchar *module_name);
19
20
#ifndef __CYGWIN__
21
22
gchar*
23
_g_module_build_path (const gchar *directory,
24
          const gchar *module_name)
25
0
{
26
0
  if (directory && *directory) {
27
0
    if (strncmp (module_name, "lib", 3) == 0)
28
0
      return g_strconcat (directory, "/", module_name, NULL);
29
0
    else
30
0
      return g_strconcat (directory, "/lib", module_name, "." G_MODULE_SUFFIX, NULL);
31
0
  } else if (strncmp (module_name, "lib", 3) == 0)
32
0
    return g_strdup (module_name);
33
0
  else
34
0
    return g_strconcat ("lib", module_name, "." G_MODULE_SUFFIX, NULL);
35
0
}
36
37
#else /* __CYGWIN__ */
38
39
#ifdef __MSYS__
40
#define CYG_MODULE_PREFIX "msys-"
41
#else
42
#define CYG_MODULE_PREFIX "cyg"
43
#endif
44
45
gchar*
46
_g_module_build_path (const gchar *directory,
47
                      const gchar *module_name)
48
{
49
  bool module_name_has_prefix = g_str_has_prefix (module_name, CYG_MODULE_PREFIX) ||
50
                                g_str_has_prefix (module_name, "lib");
51
52
  if (directory && *directory)
53
    return module_name_has_prefix ?
54
           g_strconcat (directory, "/", module_name, NULL) :
55
           g_strconcat (directory, "/" CYG_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
56
  else
57
    return module_name_has_prefix ?
58
           g_strdup (module_name) :
59
           g_strconcat (CYG_MODULE_PREFIX, module_name, "." G_MODULE_SUFFIX, NULL);
60
}
61
62
#endif  /* __CYGWIN__ */
63
64
#endif