patch adding G_GNUC_CONST to get_type()

View: New views
1 Messages — Rating Filter:   Alert me  

patch adding G_GNUC_CONST to get_type()

by Jean-Yves Lefort :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The attached patch adds the G_GNUC_CONST attribute to get_type()
function declarations. It is a performance improvement which allows
the compiler to move get_type() calls out of loops, etc.

--
Jean-Yves Lefort <jylefort@...>

[gob2-jylefort-const-gettype.diff]

Index: src/main.c
===================================================================
RCS file: /usr/local/cvsroot/gob2/src/main.c,v
retrieving revision 1.4
diff -u -r1.4 main.c
--- src/main.c 1 Feb 2008 21:39:50 -0000 1.4
+++ src/main.c 25 Feb 2008 20:23:09 -0000
@@ -3644,7 +3644,7 @@
     " */\n");
 
  if ( ! overrode_get_type) {
- out_printf (outh, "GType\t%s_get_type\t(void);\n", funcbase);
+ out_printf (outh, "GType\t%s_get_type\t(void) G_GNUC_CONST;\n", funcbase);
  }
 
  for(li = c->nodes; li != NULL; li = li->next) {



--
to unsubscribe:
send mail to minimalist@... with "unsubscribe gob-list" in the subject

attachment0 (196 bytes) Download Attachment