mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 10:42:11 +01:00
gdbusconnection: Make a backport of g_set_str() available
A subsequent commit will need this. Copying all of g_set_str() into a private header seems cleaner than replacing the call to it. Helps: GNOME/glib#3268 Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
c4e3022918
commit
c805fd3862
@ -95,6 +95,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "glib-private.h"
|
||||||
#include "gdbusauth.h"
|
#include "gdbusauth.h"
|
||||||
#include "gdbusutils.h"
|
#include "gdbusutils.h"
|
||||||
#include "gdbusaddress.h"
|
#include "gdbusaddress.h"
|
||||||
|
@ -201,4 +201,22 @@ GLibPrivateVTable *glib__private__ (void);
|
|||||||
# define GLIB_DEFAULT_LOCALE ""
|
# define GLIB_DEFAULT_LOCALE ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Backported from GLib 2.78.x, where it is public API in gstrfuncs.h */
|
||||||
|
static inline gboolean
|
||||||
|
g_set_str (char **str_pointer,
|
||||||
|
const char *new_str)
|
||||||
|
{
|
||||||
|
char *copy;
|
||||||
|
|
||||||
|
if (*str_pointer == new_str ||
|
||||||
|
(*str_pointer && new_str && strcmp (*str_pointer, new_str) == 0))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
copy = g_strdup (new_str);
|
||||||
|
g_free (*str_pointer);
|
||||||
|
*str_pointer = copy;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __GLIB_PRIVATE_H__ */
|
#endif /* __GLIB_PRIVATE_H__ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user