core: add nm_utils_to_string_buffer global buffer
Having a static string buffer for convenience is useful not only for platform. Define the string buffer in NetworkManagerUtils.h, so that all to-string functions can reuse *one* buffer. Of course, this has the potential danger, that different to-string method might reuse the same buffer. Hence, low-level library functions are adviced to use their own buffer, because an upper level might already use the global buffer for another string.
This commit is contained in:
@@ -2391,8 +2391,8 @@ cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMP
|
||||
NMPlatform *platform = NM_PLATFORM (user_data);
|
||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||
const NMPClass *klass;
|
||||
char str_buf[sizeof (_nm_platform_to_string_buffer)];
|
||||
char str_buf2[sizeof (_nm_platform_to_string_buffer)];
|
||||
char str_buf[sizeof (_nm_utils_to_string_buffer)];
|
||||
char str_buf2[sizeof (_nm_utils_to_string_buffer)];
|
||||
|
||||
nm_assert (old || new);
|
||||
nm_assert (NM_IN_SET (ops_type, NMP_CACHE_OPS_ADDED, NMP_CACHE_OPS_REMOVED, NMP_CACHE_OPS_UPDATED));
|
||||
|
Reference in New Issue
Block a user