mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 04:50:17 +01:00
glib-aux: assert that nm_utils_to_string_buffer_init() does not use the global buffer
For convenience, most to-string methods call nm_utils_to_string_buffer_init(). This allows to omit the string buffer and use a global (thread-local) buffer. That "convenience" seems error prone. Start drop it. Start by adding a g_return_if_reached() assertion to catch the cases that use it.
This commit is contained in:
parent
b87afac8e8
commit
27752bfd5b
1 changed files with 5 additions and 0 deletions
|
|
@ -871,6 +871,11 @@ nm_utils_to_string_buffer_init(char **buf, gsize *len)
|
|||
if (!*buf) {
|
||||
*buf = _nm_utils_to_string_buffer;
|
||||
*len = NM_UTILS_TO_STRING_BUFFER_SIZE;
|
||||
|
||||
/* We no longer want to support callers to omit the buffer
|
||||
* and fallback to the global buffer. Callers should be fixed
|
||||
* to always provide a valid buffer. */
|
||||
g_return_if_reached();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue