[gtk/font-chooser-feature-work: 1/2] Some strdup avoidance




commit 2017f3debee788b993363b1ed0fcce8629f2560c
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 25 14:33:30 2022 -0400

    Some strdup avoidance

 gdk/gdk-private.h        | 4 ++++
 gdk/gdkclipboard.c       | 3 ++-
 gdk/gdkcontentprovider.c | 3 ++-
 gdk/gdkpaintable.c       | 5 +++--
 gdk/gdktoplevel.c        | 3 ++-
 5 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gdk/gdk-private.h b/gdk/gdk-private.h
index 1100087775..3c125a9a2c 100644
--- a/gdk/gdk-private.h
+++ b/gdk/gdk-private.h
@@ -59,4 +59,8 @@ void gdk_source_set_static_name_by_id (guint       tag,
 #define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
 #endif
 
+#ifndef I_
+#define I_(string) g_intern_static_string (string)
+#endif
+
 #endif /* __GDK__PRIVATE_H__ */
diff --git a/gdk/gdkclipboard.c b/gdk/gdkclipboard.c
index 95e0fda40e..2600999f2a 100644
--- a/gdk/gdkclipboard.c
+++ b/gdk/gdkclipboard.c
@@ -29,6 +29,7 @@
 #include "gdkintl.h"
 #include "gdkpipeiostreamprivate.h"
 #include "gdktexture.h"
+#include "gdk-private.h"
 
 #include <gobject/gvaluecollector.h>
 
@@ -408,7 +409,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
    * Emitted when the clipboard changes ownership.
    */
   signals[CHANGED] =
-    g_signal_new ("changed",
+    g_signal_new (I_("changed"),
                   G_TYPE_FROM_CLASS (class),
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (GdkClipboardClass, changed),
diff --git a/gdk/gdkcontentprovider.c b/gdk/gdkcontentprovider.c
index 043e165d59..f4d6d316a6 100644
--- a/gdk/gdkcontentprovider.c
+++ b/gdk/gdkcontentprovider.c
@@ -23,6 +23,7 @@
 #include "gdkclipboard.h"
 #include "gdkcontentformats.h"
 #include "gdkintl.h"
+#include "gdk-private.h"
 
 /**
  * GdkContentProvider:
@@ -197,7 +198,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
    * Emitted whenever the content provided by this provider has changed.
    */
   signals[CONTENT_CHANGED] =
-    g_signal_new ("content-changed",
+    g_signal_new (I_("content-changed"),
                   G_TYPE_FROM_CLASS (class),
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (GdkContentProviderClass, content_changed),
diff --git a/gdk/gdkpaintable.c b/gdk/gdkpaintable.c
index 51d0e1347c..c6e64a4fdb 100644
--- a/gdk/gdkpaintable.c
+++ b/gdk/gdkpaintable.c
@@ -22,6 +22,7 @@
 #include "gdkpaintable.h"
 
 #include "gdksnapshotprivate.h"
+#include "gdk-private.h"
 
 /* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
 void            gtk_snapshot_push_debug                 (GdkSnapshot            *snapshot,
@@ -170,7 +171,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
    * the icon theme for an icon changing.
    */
   signals[INVALIDATE_CONTENTS] =
-    g_signal_new ("invalidate-contents",
+    g_signal_new (I_("invalidate-contents"),
                   GDK_TYPE_PAINTABLE,
                   G_SIGNAL_RUN_LAST,
                   0,
@@ -194,7 +195,7 @@ gdk_paintable_default_init (GdkPaintableInterface *iface)
    * the contents of a toplevel surface being resized.
    */
   signals[INVALIDATE_SIZE] =
-    g_signal_new ("invalidate-size",
+    g_signal_new (I_("invalidate-size"),
                   GDK_TYPE_PAINTABLE,
                   G_SIGNAL_RUN_LAST,
                   0,
diff --git a/gdk/gdktoplevel.c b/gdk/gdktoplevel.c
index 8c92cd9c97..e64905355a 100644
--- a/gdk/gdktoplevel.c
+++ b/gdk/gdktoplevel.c
@@ -24,6 +24,7 @@
 #include "gdkdisplay.h"
 #include "gdkenumtypes.h"
 #include "gdkintl.h"
+#include "gdk-private.h"
 
 #include <graphene-gobject.h>
 #include <math.h>
@@ -247,7 +248,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
    * will result in an arbitrary size being used as a result.
    */
   signals[COMPUTE_SIZE] =
-    g_signal_new ("compute-size",
+    g_signal_new (I_("compute-size"),
                   GDK_TYPE_TOPLEVEL,
                   G_SIGNAL_RUN_LAST,
                   0,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]