[Geany-devel] [patch] "Constify" some arguments and fields

Colomban Wendling lists.ban at xxxxx
Wed Apr 21 20:51:33 UTC 2010


I'm used to compile my programs with quite strict compiler options [1],
and it made me see that the plugin API had some non-const arguments or
field where it probably should have const ones - where string literals
are most likely expected.
I think of keybindings_set_item(), plugin_signal_connect(), the
PluginInfo structure, etc. I think it is quite important since it makes
the plugin API cleaner (IMHO) and allows to write more clean plugins (no
more useless implicit promotions that may even be invalid).
Attached a patch with the suggested changes.

Although this changes some API code, I think it is completely API and
ABI [2] compatible: changes only makes the API more permissive on given

On quite the same topic, would a patch that fixes a lot of small
problems like that in Geany's core be appreciated? It isn't hard to do
but I think it would clean the code a bit.


[1] -Wall -W -O2 -Wunused -Wunreachable-code -Wformat=2 -Wundef -Wshadow
-Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wconversion
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute
-Wredundant-decls -Wnested-externs -pedantic
[2] even though I don't know so much about ABI things, I doubt the const
information would ever be part of it - at least on x86.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-plugin-api-more-const-args.diff
Type: text/x-patch
Size: 4361 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100421/56dbe2d1/attachment.bin>

More information about the Devel mailing list