summaryrefslogtreecommitdiffstats
path: root/gobject/gobjectmodule.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-17 09:51:19 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-17 09:51:19 +0000
commitfefcb864e35f595f82b6053a7a5857860eecbe69 (patch)
tree8176829598c900e5ad18b74a463ffdd0b04785c1 /gobject/gobjectmodule.c
parent5150b46218e113795279f7708002ef156972eeb8 (diff)
downloadpygobject-fefcb864e35f595f82b6053a7a5857860eecbe69.tar.gz
pygobject-fefcb864e35f595f82b6053a7a5857860eecbe69.tar.xz
pygobject-fefcb864e35f595f82b6053a7a5857860eecbe69.zip
Use the prefix G_IO_ for stripping constants instead of just G_ Check so
2008-07-17 Johan Dahlin <johan@gnome.org> * gio/giomodule.c (init_gio): Use the prefix G_IO_ for stripping constants instead of just G_ * gobject/gobjectmodule.c (pyg_constant_strip_prefix): Check so the fist part of name and strip_prefix are the same, if they don't, just strip of the part of strip_prefix which matches. This removes the initial IO_* prefix for some constants in gio. Eg, gio.IO_ERROR_* -> gio.ERROR_* svn path=/trunk/; revision=817
Diffstat (limited to 'gobject/gobjectmodule.c')
-rw-r--r--gobject/gobjectmodule.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 3bd5645..d9b22ed 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -2964,15 +2964,24 @@ const gchar *
pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix)
{
gint prefix_len;
- guint j;
+ guint i;
prefix_len = strlen(strip_prefix);
-
+
+ /* Check so name starts with strip_prefix, if it doesn't:
+ * return the rest of the part which doesn't match
+ */
+ for (i = 0; i < prefix_len; i++) {
+ if (name[i] != strip_prefix[i] && name[i] != '_') {
+ return &name[i];
+ }
+ }
+
/* strip off prefix from value name, while keeping it a valid
* identifier */
- for (j = prefix_len; j >= 0; j--) {
- if (g_ascii_isalpha(name[j]) || name[j] == '_') {
- return &name[j];
+ for (i = prefix_len; i >= 0; i--) {
+ if (g_ascii_isalpha(name[i]) || name[i] == '_') {
+ return &name[i];
}
}
return name;