Skip to content

Commit

Permalink
cleanup: proxy_resolver_*_get_interface() return pointer to const ifaces
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-nsk committed Dec 8, 2023
1 parent 863f4af commit d065338
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct g_proxy_resolver_s {
// Library reference count
int32_t ref_count;
// Proxy resolver interface
proxy_resolver_i_s *proxy_resolver_i;
const proxy_resolver_i_s *proxy_resolver_i;
// Thread pool
void *threadpool;
} g_proxy_resolver_s;
Expand Down
4 changes: 2 additions & 2 deletions resolver_gnome3.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ bool proxy_resolver_gnome3_global_cleanup(void) {
return true;
}

proxy_resolver_i_s *proxy_resolver_gnome3_get_interface(void) {
static proxy_resolver_i_s proxy_resolver_gnome3_i = {
const proxy_resolver_i_s *proxy_resolver_gnome3_get_interface(void) {
static const proxy_resolver_i_s proxy_resolver_gnome3_i = {
proxy_resolver_gnome3_get_proxies_for_url,
proxy_resolver_gnome3_get_list,
proxy_resolver_gnome3_get_error,
Expand Down
2 changes: 1 addition & 1 deletion resolver_gnome3.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ bool proxy_resolver_gnome3_delete(void **ctx);
bool proxy_resolver_gnome3_global_init(void);
bool proxy_resolver_gnome3_global_cleanup(void);

proxy_resolver_i_s *proxy_resolver_gnome3_get_interface(void);
const proxy_resolver_i_s *proxy_resolver_gnome3_get_interface(void);
4 changes: 2 additions & 2 deletions resolver_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ bool proxy_resolver_mac_global_cleanup(void) {
return true;
}

proxy_resolver_i_s *proxy_resolver_mac_get_interface(void) {
static proxy_resolver_i_s proxy_resolver_mac_i = {
const proxy_resolver_i_s *proxy_resolver_mac_get_interface(void) {
static const proxy_resolver_i_s proxy_resolver_mac_i = {
proxy_resolver_mac_get_proxies_for_url,
proxy_resolver_mac_get_list,
proxy_resolver_mac_get_error,
Expand Down
2 changes: 1 addition & 1 deletion resolver_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ bool proxy_resolver_mac_delete(void **ctx);
bool proxy_resolver_mac_global_init(void);
bool proxy_resolver_mac_global_cleanup(void);

proxy_resolver_i_s *proxy_resolver_mac_get_interface(void);
const proxy_resolver_i_s *proxy_resolver_mac_get_interface(void);
4 changes: 2 additions & 2 deletions resolver_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ bool proxy_resolver_posix_global_cleanup(void) {
return true;
}

proxy_resolver_i_s *proxy_resolver_posix_get_interface(void) {
static proxy_resolver_i_s proxy_resolver_posix_i = {
const proxy_resolver_i_s *proxy_resolver_posix_get_interface(void) {
static const proxy_resolver_i_s proxy_resolver_posix_i = {
proxy_resolver_posix_get_proxies_for_url,
proxy_resolver_posix_get_list,
proxy_resolver_posix_get_error,
Expand Down
2 changes: 1 addition & 1 deletion resolver_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ bool proxy_resolver_posix_global_init(void);
bool proxy_resolver_posix_init_ex(void *threadpool);
bool proxy_resolver_posix_global_cleanup(void);

proxy_resolver_i_s *proxy_resolver_posix_get_interface(void);
const proxy_resolver_i_s *proxy_resolver_posix_get_interface(void);
4 changes: 2 additions & 2 deletions resolver_win8.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ bool proxy_resolver_win8_global_cleanup(void) {
return true;
}

proxy_resolver_i_s *proxy_resolver_win8_get_interface(void) {
static proxy_resolver_i_s proxy_resolver_win8_i = {
const proxy_resolver_i_s *proxy_resolver_win8_get_interface(void) {
static const proxy_resolver_i_s proxy_resolver_win8_i = {
proxy_resolver_win8_get_proxies_for_url,
proxy_resolver_win8_get_list,
proxy_resolver_win8_get_error,
Expand Down
2 changes: 1 addition & 1 deletion resolver_win8.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ bool proxy_resolver_win8_delete(void **ctx);
bool proxy_resolver_win8_global_init(void);
bool proxy_resolver_win8_global_cleanup(void);

proxy_resolver_i_s *proxy_resolver_win8_get_interface(void);
const proxy_resolver_i_s *proxy_resolver_win8_get_interface(void);
25 changes: 13 additions & 12 deletions resolver_winrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,17 +409,18 @@ bool proxy_resolver_winrt_global_cleanup(void) {
return true;
}

proxy_resolver_i_s *proxy_resolver_winrt_get_interface(void) {
static proxy_resolver_i_s proxy_resolver_winrt_i = {proxy_resolver_winrt_get_proxies_for_url,
proxy_resolver_winrt_get_list,
proxy_resolver_winrt_get_error,
proxy_resolver_winrt_wait,
proxy_resolver_winrt_cancel,
proxy_resolver_winrt_create,
proxy_resolver_winrt_delete,
true, // get_proxies_for_url is handled asynchronously
true, // get_proxies_for_url takes into account system config
proxy_resolver_winrt_global_init,
proxy_resolver_winrt_global_cleanup};
const proxy_resolver_i_s *proxy_resolver_winrt_get_interface(void) {
static const proxy_resolver_i_s proxy_resolver_winrt_i = {
proxy_resolver_winrt_get_proxies_for_url,
proxy_resolver_winrt_get_list,
proxy_resolver_winrt_get_error,
proxy_resolver_winrt_wait,
proxy_resolver_winrt_cancel,
proxy_resolver_winrt_create,
proxy_resolver_winrt_delete,
true, // get_proxies_for_url is handled asynchronously
true, // get_proxies_for_url takes into account system config
proxy_resolver_winrt_global_init,
proxy_resolver_winrt_global_cleanup};
return &proxy_resolver_winrt_i;
}
2 changes: 1 addition & 1 deletion resolver_winrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ bool proxy_resolver_winrt_delete(void **ctx);
bool proxy_resolver_winrt_global_init(void);
bool proxy_resolver_winrt_global_cleanup(void);

proxy_resolver_i_s *proxy_resolver_winrt_get_interface(void);
const proxy_resolver_i_s *proxy_resolver_winrt_get_interface(void);
4 changes: 2 additions & 2 deletions resolver_winxp.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ bool proxy_resolver_winxp_global_cleanup(void) {
return true;
}

proxy_resolver_i_s *proxy_resolver_winxp_get_interface(void) {
static proxy_resolver_i_s proxy_resolver_winxp_i = {
const proxy_resolver_i_s *proxy_resolver_winxp_get_interface(void) {
static const proxy_resolver_i_s proxy_resolver_winxp_i = {
proxy_resolver_winxp_get_proxies_for_url,
proxy_resolver_winxp_get_list,
proxy_resolver_winxp_get_error,
Expand Down
2 changes: 1 addition & 1 deletion resolver_winxp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ bool proxy_resolver_winxp_delete(void **ctx);
bool proxy_resolver_winxp_global_init(void);
bool proxy_resolver_winxp_global_cleanup(void);

proxy_resolver_i_s *proxy_resolver_winxp_get_interface(void);
const proxy_resolver_i_s *proxy_resolver_winxp_get_interface(void);

0 comments on commit d065338

Please sign in to comment.