Skip to content

Commit 18df4f9

Browse files
committed
build: fix: Ubuntu 26.04 LTS
1 parent 85d8713 commit 18df4f9

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

.github/workflows/ubuntu.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ jobs:
4141
gcov-exec: llvm-cov-15 gcov
4242
codecov: ubuntu
4343

44+
- name: Build - Ubuntu 26 Clang
45+
runs-on: ubuntu-26.04
46+
compiler: clang
47+
cxx-compiler: clang++
48+
cmake-args: -G Ninja -D PROXYRES_CODE_COVERAGE=ON
49+
packages: llvm-21 libjavascriptcoregtk-6.0-dev gsettings-desktop-schemas
50+
gcov-exec: llvm-cov-21 gcov
51+
codecov: ubuntu
52+
4453
- name: Build - Ubuntu Clang (curl)
4554
runs-on: ubuntu-latest
4655
compiler: clang
@@ -50,6 +59,15 @@ jobs:
5059
gcov-exec: llvm-cov-15 gcov
5160
codecov: ubuntu_curl
5261

62+
- name: Build - Ubuntu 26 Clang (curl)
63+
runs-on: ubuntu-26.04
64+
compiler: clang
65+
cxx-compiler: clang++
66+
cmake-args: -G Ninja -D PROXYRES_CODE_COVERAGE=ON -D PROXYRES_CURL=ON
67+
packages: llvm-21 libjavascriptcoregtk-6.0-dev gsettings-desktop-schemas
68+
gcov-exec: llvm-cov-21 gcov
69+
codecov: ubuntu_curl
70+
5371
- name: Build - Ubuntu Clang (duktape)
5472
runs-on: ubuntu-latest
5573
compiler: clang
@@ -59,6 +77,15 @@ jobs:
5977
gcov-exec: llvm-cov-15 gcov
6078
codecov: ubuntu_duktape
6179

80+
- name: Build - Ubuntu 26 Clang (duktape)
81+
runs-on: ubuntu-26.04
82+
compiler: clang
83+
cxx-compiler: clang++
84+
cmake-args: -G Ninja -D PROXYRES_CODE_COVERAGE=ON -D PROXYRES_DUKTAPE=ON
85+
packages: llvm-21 libglib2.0-dev gsettings-desktop-schemas
86+
gcov-exec: llvm-cov-21 gcov
87+
codecov: ubuntu_duktape
88+
6289
steps:
6390
- name: Install dependencies
6491
run: |

config_gnome3.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,27 @@ typedef struct g_proxy_config_gnome3_s {
2525
// Glib module handle
2626
void *glib_module;
2727
// Glib memory functions
28+
#if G_GNUC_CHECK_VERSION(4, 1) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_78 && defined(G_HAVE_FREE_SIZED)
29+
void(*g_free_sized)(gpointer mem, size_t size);
30+
#endif
2831
void (*g_free)(gpointer mem);
2932
void (*g_strfreev)(gchar **str_array);
3033
} g_proxy_config_gnome3_s;
3134

3235
g_proxy_config_gnome3_s g_proxy_config_gnome3;
3336

37+
#ifdef g_free
38+
# undef g_free
39+
# if G_GNUC_CHECK_VERSION(4, 1) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_78 && defined(G_HAVE_FREE_SIZED)
40+
# define g_free(mem) \
41+
(__builtin_object_size((mem), 0) != ((size_t)-1)) \
42+
? g_proxy_config_gnome3.g_free_sized(mem, __builtin_object_size((mem), 0)) \
43+
: (g_proxy_config_gnome3.g_free)(mem)
44+
# else
45+
# define gfree(mem) (g_proxy_config_gnome3.g_free)(mem)
46+
# endif
47+
#endif
48+
3449
static bool proxy_config_gnome3_is_mode(const char *mode) {
3550
bool equal = false;
3651

@@ -41,7 +56,7 @@ static bool proxy_config_gnome3_is_mode(const char *mode) {
4156
char *system_mode = g_proxy_config_gnome3.g_settings_get_string(settings, "mode");
4257
if (system_mode) {
4358
equal = strcmp(system_mode, mode) == 0;
44-
g_proxy_config_gnome3.g_free(system_mode);
59+
g_free(system_mode);
4560
}
4661
g_proxy_config_gnome3.g_object_unref(settings);
4762
return equal;
@@ -63,7 +78,7 @@ char *proxy_config_gnome3_get_auto_config_url(void) {
6378
if (url) {
6479
if (*url)
6580
auto_config_url = strdup(url);
66-
g_proxy_config_gnome3.g_free(url);
81+
g_free(url);
6782
}
6883
g_proxy_config_gnome3.g_object_unref(settings);
6984
return auto_config_url;
@@ -108,7 +123,7 @@ char *proxy_config_gnome3_get_proxy(const char *scheme) {
108123
snprintf(proxy, max_proxy, "%s:%" PRIu32 "", host, port);
109124
}
110125

111-
g_proxy_config_gnome3.g_free(host);
126+
g_free(host);
112127
}
113128
g_proxy_config_gnome3.g_object_unref(settings);
114129
return proxy;
@@ -162,9 +177,15 @@ bool proxy_config_gnome3_global_init(void) {
162177
goto gnome3_init_error;
163178

164179
// Glib functions
165-
g_proxy_config_gnome3.g_free = (void (*)(gpointer))dlsym(g_proxy_config_gnome3.glib_module, "g_free");
180+
(g_proxy_config_gnome3.g_free) = (void (*)(gpointer))dlsym(g_proxy_config_gnome3.glib_module, "g_free");
166181
if (!g_proxy_config_gnome3.g_free)
167182
goto gnome3_init_error;
183+
#if G_GNUC_CHECK_VERSION(4, 1) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_78 && defined(G_HAVE_FREE_SIZED)
184+
g_proxy_config_gnome3.g_free_sized =
185+
(void (*)(gpointer, size_t))dlsym(g_proxy_config_gnome3.glib_module, "g_free_sized");
186+
if (!g_proxy_config_gnome3.g_free_sized)
187+
goto gnome3_init_error;
188+
#endif
168189
g_proxy_config_gnome3.g_strfreev = (void (*)(gchar **))dlsym(g_proxy_config_gnome3.glib_module, "g_strfreev");
169190
if (!g_proxy_config_gnome3.g_strfreev)
170191
goto gnome3_init_error;

0 commit comments

Comments
 (0)