SF.net SVN: geany:[4851] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Apr 22 12:25:20 UTC 2010


Revision: 4851
          http://geany.svn.sourceforge.net/geany/?rev=4851&view=rev
Author:   ntrel
Date:     2010-04-22 12:25:20 +0000 (Thu, 22 Apr 2010)

Log Message:
-----------
Constify some more string pointers in the API (patch by
Colomban Wendling, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/keybindings.c
    trunk/src/keybindings.h
    trunk/src/plugindata.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-04-22 12:03:37 UTC (rev 4850)
+++ trunk/ChangeLog	2010-04-22 12:25:20 UTC (rev 4851)
@@ -3,6 +3,9 @@
  * src/plugindata.h, src/pluginutils.c, src/pluginutils.h, THANKS:
    Make plugin_signal_connect() string argument const (patch by
    Colomban Wendling, thanks).
+ * src/keybindings.c, src/keybindings.h, src/plugindata.h:
+   Constify some more string pointers in the API (patch by
+   Colomban Wendling, thanks).
 
 
 2010-04-21  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2010-04-22 12:03:37 UTC (rev 4850)
+++ trunk/src/keybindings.c	2010-04-22 12:25:20 UTC (rev 4851)
@@ -144,7 +144,7 @@
  * @return The keybinding - normally this is ignored. */
 GeanyKeyBinding *keybindings_set_item(GeanyKeyGroup *group, gsize key_id,
 		GeanyKeyCallback callback, guint key, GdkModifierType mod,
-		gchar *kf_name, gchar *label, GtkWidget *menu_item)
+		const gchar *kf_name, const gchar *label, GtkWidget *menu_item)
 {
 	GeanyKeyBinding *kb = keybindings_get_item(group, key_id);
 
@@ -156,8 +156,9 @@
 	}
 	else
 	{
-		kb->name = kf_name;
-		kb->label = label;
+		/* we don't touch them unless group->plugin is set, cast is safe */
+		kb->name = (gchar *)kf_name;
+		kb->label = (gchar *)label;
 	}
 	kb->key = key;
 	kb->mods = mod;

Modified: trunk/src/keybindings.h
===================================================================
--- trunk/src/keybindings.h	2010-04-22 12:03:37 UTC (rev 4850)
+++ trunk/src/keybindings.h	2010-04-22 12:25:20 UTC (rev 4851)
@@ -350,7 +350,7 @@
 
 GeanyKeyBinding *keybindings_set_item(GeanyKeyGroup *group, gsize key_id,
 		GeanyKeyCallback callback, guint key, GdkModifierType mod,
-		gchar *name, gchar *label, GtkWidget *menu_item);
+		const gchar *name, const gchar *label, GtkWidget *menu_item);
 
 GeanyKeyBinding *keybindings_get_item(GeanyKeyGroup *group, gsize key_id);
 

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2010-04-22 12:03:37 UTC (rev 4850)
+++ trunk/src/plugindata.h	2010-04-22 12:25:20 UTC (rev 4851)
@@ -79,13 +79,13 @@
 typedef struct PluginInfo
 {
 	/** The name of the plugin. */
-	gchar	*name;
+	const gchar	*name;
 	/** The description of the plugin. */
-	gchar	*description;
+	const gchar	*description;
 	/** The version of the plugin. */
-	gchar	*version;
+	const gchar	*version;
 	/** The author of the plugin. */
-	gchar	*author;
+	const gchar	*author;
 }
 PluginInfo;
 
@@ -153,7 +153,7 @@
 {
 	/** The name of signal, must be an existing signal. For a list of available signals,
 	 *  please see the @link signals Signal documentation @endlink. */
-	gchar		*signal_name;
+	const gchar	*signal_name;
 	/** A callback function which is called when the signal is emitted. */
 	GCallback	callback;
 	/** Set to TRUE to connect your handler with g_signal_connect_after(). */
@@ -490,7 +490,7 @@
 	void		(*keybindings_send_command) (guint group_id, guint key_id);
 	struct GeanyKeyBinding* (*keybindings_set_item) (struct GeanyKeyGroup *group, gsize key_id,
 					_GeanyKeyCallback callback, guint key, GdkModifierType mod,
-					gchar *name, gchar *label, GtkWidget *menu_item);
+					const gchar *name, const gchar *label, GtkWidget *menu_item);
 	struct GeanyKeyBinding* (*keybindings_get_item)(struct GeanyKeyGroup *group, gsize key_id);
 
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list