mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 03:30:09 +01:00
merge: branch 'jv/fix-rawhide-build'
all: fix NM compilation on rawhide https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2321
This commit is contained in:
commit
0b61924048
15 changed files with 63 additions and 44 deletions
|
|
@ -32,11 +32,11 @@ ip4_process_dhcpcd_rfc3442_routes(const char *iface,
|
|||
in_addr_t address,
|
||||
guint32 *out_gwaddr)
|
||||
{
|
||||
gs_free const char **routes = NULL;
|
||||
const char **r;
|
||||
gs_free char **routes = NULL;
|
||||
char **r;
|
||||
gboolean have_routes = FALSE;
|
||||
|
||||
routes = nm_strsplit_set(str, " ");
|
||||
routes = (char **) nm_strsplit_set(str, " ");
|
||||
if (!routes)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -1510,7 +1510,7 @@ _domain_track_is_shadowed(GHashTable *ht,
|
|||
const char **out_parent,
|
||||
int *out_parent_priority)
|
||||
{
|
||||
char *parent;
|
||||
const char *parent;
|
||||
int parent_priority;
|
||||
|
||||
if (!ht)
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ parse_connection_from_shadowed_file(const char *path, GError **error)
|
|||
{
|
||||
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||
gs_free char *base_dir = NULL;
|
||||
char *sep;
|
||||
const char *sep;
|
||||
|
||||
keyfile = g_key_file_new();
|
||||
if (!g_key_file_load_from_file(keyfile, path, G_KEY_FILE_NONE, error))
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ software_add(NMLinkType link_type, const char *name)
|
|||
int r;
|
||||
const NMPlatformLnkBond nm_platform_lnk_bond_default = {
|
||||
.mode = nmtst_rand_select(3, 1),
|
||||
.use_carrier = 1,
|
||||
};
|
||||
|
||||
r = nm_platform_link_bond_add(NM_PLATFORM_GET, name, &nm_platform_lnk_bond_default, NULL);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ get_full_file_path(const char *ifcfg_path, const char *file_path)
|
|||
{
|
||||
const char *base = file_path;
|
||||
gs_free char *dirname = NULL;
|
||||
char *p;
|
||||
const char *p;
|
||||
|
||||
g_return_val_if_fail(ifcfg_path != NULL, NULL);
|
||||
g_return_val_if_fail(file_path != NULL, NULL);
|
||||
|
|
|
|||
|
|
@ -212,18 +212,19 @@ validate_type_utf8(const struct Opt *opt, const char *value, const guint32 len)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
validate_type_keyword(const struct Opt *opt, const char *value, const guint32 len)
|
||||
validate_type_keyword(const struct Opt *opt, const char *value_in, const guint32 len)
|
||||
{
|
||||
gs_free char *value_free = NULL;
|
||||
char *value;
|
||||
|
||||
nm_assert(opt);
|
||||
nm_assert(value);
|
||||
nm_assert(value_in);
|
||||
|
||||
/* Allow everything */
|
||||
if (!opt->str_allowed)
|
||||
return TRUE;
|
||||
|
||||
value = nm_strndup_a(300, value, len, &value_free);
|
||||
value = nm_strndup_a(300, value_in, len, &value_free);
|
||||
|
||||
/* validate each space-separated word in 'value' */
|
||||
|
||||
|
|
|
|||
|
|
@ -483,8 +483,8 @@ nm_utils_validate_shared_dhcp_range(const char *shared_dhcp_range,
|
|||
GPtrArray *addresses,
|
||||
GError **error)
|
||||
{
|
||||
char *start_address_str;
|
||||
char *end_address_str;
|
||||
const char *start_address_str;
|
||||
const char *end_address_str;
|
||||
NMIPAddress *interface_address_with_prefix;
|
||||
NMIPAddr interface_address;
|
||||
NMIPAddr start_address;
|
||||
|
|
@ -825,7 +825,7 @@ nm_dns_uri_parse(int addr_family, const char *str, NMDnsServer *dns, GError **er
|
|||
addr = nm_strndup_a(100, addr_port, end - addr_port, &addr_heap);
|
||||
|
||||
/* IPv6 link-local scope-id */
|
||||
perc = strchr(addr, '%');
|
||||
perc = (char *) strchr(addr, '%');
|
||||
if (perc) {
|
||||
*perc = '\0';
|
||||
if (g_strlcpy(dns->interface, perc + 1, sizeof(dns->interface))
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ NMBridgeVlan *
|
|||
nm_bridge_vlan_from_str(const char *str, GError **error)
|
||||
{
|
||||
NMBridgeVlan *vlan = NULL;
|
||||
gs_free const char **tokens = NULL;
|
||||
gs_free char **tokens = NULL;
|
||||
guint i, vid_start, vid_end = 0;
|
||||
gboolean pvid = FALSE;
|
||||
gboolean untagged = FALSE;
|
||||
|
|
@ -482,7 +482,7 @@ nm_bridge_vlan_from_str(const char *str, GError **error)
|
|||
g_return_val_if_fail(str, NULL);
|
||||
g_return_val_if_fail(!error || !*error, NULL);
|
||||
|
||||
tokens = nm_utils_escaped_tokens_split(str, NM_ASCII_SPACES);
|
||||
tokens = (char **) nm_utils_escaped_tokens_split(str, NM_ASCII_SPACES);
|
||||
if (!tokens || !tokens[0]) {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
|
|
|
|||
|
|
@ -4495,7 +4495,7 @@ nm_range_from_str(const char *str, GError **error)
|
|||
gs_free char *str_free = NULL;
|
||||
guint64 start;
|
||||
guint64 end = 0;
|
||||
char *c;
|
||||
const char *c;
|
||||
|
||||
g_return_val_if_fail(str, NULL);
|
||||
g_return_val_if_fail(!error || !*error, NULL);
|
||||
|
|
|
|||
|
|
@ -25,15 +25,18 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
|
|||
* Normal bsearch requires base to be nonnull. Here were require
|
||||
* that only if nmemb > 0.
|
||||
*/
|
||||
static inline void* bsearch_safe(const void *key, const void *base,
|
||||
static inline void* bsearch_safe_internal(const void *key, const void *base,
|
||||
size_t nmemb, size_t size, comparison_fn_t compar) {
|
||||
if (nmemb <= 0)
|
||||
return NULL;
|
||||
|
||||
assert(base);
|
||||
return bsearch(key, base, nmemb, size, compar);
|
||||
return (void*) bsearch(key, base, nmemb, size, compar);
|
||||
}
|
||||
|
||||
#define bsearch_safe(key, base, nmemb, size, compar) \
|
||||
const_generic((base), bsearch_safe_internal(key, base, nmemb, size, compar))
|
||||
|
||||
#define typesafe_bsearch(k, b, n, func) \
|
||||
({ \
|
||||
const typeof((b)[0]) *_k = k; \
|
||||
|
|
|
|||
|
|
@ -1470,7 +1470,7 @@ ssize_t strlevenshtein(const char *x, const char *y) {
|
|||
return t1[yl];
|
||||
}
|
||||
|
||||
char* strrstr(const char *haystack, const char *needle) {
|
||||
char* strrstr_internal(const char *haystack, const char *needle) {
|
||||
/* Like strstr() but returns the last rather than the first occurrence of "needle" in "haystack". */
|
||||
|
||||
if (!haystack || !needle)
|
||||
|
|
@ -1479,7 +1479,7 @@ char* strrstr(const char *haystack, const char *needle) {
|
|||
/* Special case: for the empty string we return the very last possible occurrence, i.e. *after* the
|
||||
* last char, not before. */
|
||||
if (*needle == 0)
|
||||
return strchr(haystack, 0);
|
||||
return (char*) strchr(haystack, 0);
|
||||
|
||||
for (const char *p = strstr(haystack, needle), *q; p; p = q) {
|
||||
q = strstr(p + 1, needle);
|
||||
|
|
|
|||
|
|
@ -27,24 +27,28 @@
|
|||
#define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */
|
||||
#define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */
|
||||
|
||||
static inline char* strstr_ptr(const char *haystack, const char *needle) {
|
||||
static inline char* strstr_ptr_internal(const char *haystack, const char *needle) {
|
||||
if (!haystack || !needle)
|
||||
return NULL;
|
||||
return strstr(haystack, needle);
|
||||
return (char*) strstr(haystack, needle);
|
||||
}
|
||||
|
||||
static inline char* strstrafter(const char *haystack, const char *needle) {
|
||||
char *p;
|
||||
#define strstr_ptr(haystack, needle) \
|
||||
const_generic(haystack, strstr_ptr_internal(haystack, needle))
|
||||
|
||||
static inline char* strstrafter_internal(const char *haystack, const char *needle) {
|
||||
/* Returns NULL if not found, or pointer to first character after needle if found */
|
||||
|
||||
p = strstr_ptr(haystack, needle);
|
||||
char *p = (char*) strstr_ptr(haystack, needle);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
return p + strlen(needle);
|
||||
}
|
||||
|
||||
#define strstrafter(haystack, needle) \
|
||||
const_generic(haystack, strstrafter_internal(haystack, needle))
|
||||
|
||||
static inline const char* strnull(const char *s) {
|
||||
return s ?: "(null)";
|
||||
}
|
||||
|
|
@ -300,6 +304,8 @@ bool version_is_valid_versionspec(const char *s);
|
|||
|
||||
ssize_t strlevenshtein(const char *x, const char *y);
|
||||
|
||||
char* strrstr(const char *haystack, const char *needle);
|
||||
char* strrstr_internal(const char *haystack, const char *needle);
|
||||
#define strrstr(haystack, needle) \
|
||||
const_generic(haystack, strrstr_internal(haystack, needle))
|
||||
|
||||
size_t str_common_prefix(const char *a, const char *b);
|
||||
|
|
|
|||
|
|
@ -512,3 +512,10 @@ assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
|
|||
#else /* NM_IGNORED */
|
||||
#define PROJECT_FILE __FILE__
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
/* This macro is used to have a const-returning and non-const returning version of a function based on
|
||||
* whether its first argument is const or not (e.g. strstr()). */
|
||||
#define const_generic(ptr, call) \
|
||||
_Generic(0 ? (ptr) : (void*) 1, \
|
||||
const void*: (const typeof(*call)*) (call), \
|
||||
void*: (call))
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ _subsystem_split(const char *subsystem_full,
|
|||
const char **out_devtype,
|
||||
char **to_free)
|
||||
{
|
||||
char *tmp, *s;
|
||||
char *tmp;
|
||||
const char *s;
|
||||
|
||||
nm_assert(subsystem_full);
|
||||
nm_assert(out_subsystem);
|
||||
|
|
@ -102,8 +103,8 @@ _subsystem_split(const char *subsystem_full,
|
|||
s = strstr(subsystem_full, "/");
|
||||
if (s) {
|
||||
tmp = g_strdup(subsystem_full);
|
||||
tmp[s - subsystem_full] = '\0';
|
||||
s = &tmp[s - subsystem_full];
|
||||
*s = '\0';
|
||||
*out_subsystem = tmp;
|
||||
*out_devtype = &s[1];
|
||||
*to_free = tmp;
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ reader_parse_rd_znet(Reader *reader, char *argument, gboolean net_ifnames)
|
|||
{
|
||||
const char *nettype;
|
||||
const char *subchannels[4] = {0, 0, 0, 0};
|
||||
const char *tmp;
|
||||
char *tmp;
|
||||
gs_free char *ifname = NULL;
|
||||
gs_free char *str_subchannels = NULL;
|
||||
const char *prefix;
|
||||
|
|
@ -1248,7 +1248,7 @@ reader_parse_rd_znet(Reader *reader, char *argument, gboolean net_ifnames)
|
|||
NULL);
|
||||
|
||||
while ((tmp = get_word(&argument, ',')) != NULL) {
|
||||
const char *key;
|
||||
char *key;
|
||||
char *val;
|
||||
|
||||
val = strchr(tmp, '=');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue