[Geany-devel] [patch] Little code/warnings cleanup (was Re: [patch] "Constify" some arguments and fields)

Enrico Tröger enrico.troeger at xxxxx
Sun Apr 25 10:33:11 UTC 2010


On Thu, 22 Apr 2010 23:56:35 +0200, Colomban wrote:

>>>> 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.
>>> Yes, but only if it's clear that const is really meant, not just to
>>> silence compiler warnings.
>> Of course. Casting away should only be done where the cast is
>> completely wanted or at least carefully understood.
>> I'll then do it unless somebody else go faster than me.
>I've took a look and fixed some warnings around and other small stuff.
>They are consts, a little uint vs. int when I'm sure it makes sense,
>staticize a few local functions, and so on.
>
>I've found 4 things that I haven't fixed/touched:
>* build.c:174: This type of assignations aren't valid C90 (it's a C99
>addition I think). Not sure it should be fixed or not since it gives a
>little gain - being sure the affected element is the right one.

I think it should be fixed as we usually try to keep the core C89/C90
compatible as there are users using compilers which require it.


>* document.c:473: The function document_stop_file_monitoring() has no
>prototype and isn't static, but the name made me think it is perhaps
>meant to be external for some reason and only misses its prototype?

While developing the GIO file monitoring code, I used that function in
dialogs.c but then removed it again. I'll make it static for now as it
isn't used anywhere else than in document.c. If necessary, we can make
it public later again.


>* main.c:1212+: What's that malloc stuff for??? These functions aren't
>even used...

http://geany.svn.sf.net/viewvc/geany?view=rev&revision=1596
and see http://lists.uvena.de/pipermail/geany/2007-June/001093.html for
the discussion about it.
Maybe we can remove rpl_malloc() because we replaced the malloc() with
g_malloc () at the same time.


>* the stash_group_add_entry() and its widget_id. The thing is that when
>it is a string it should be constant, but when it is a widget it
>shouldn't be... perhaps it is fine as now.

I think this is ok but I'll leave this to Nick.


>There is 2 patches: one that modifies the Geany's core, and the other
>that modifies that core plugins [1].

Cool, thanks a lot . Will apply the patches later today.


>[1] there is a missing free() fix for the export plugin too.

Good catch, thanks.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20100425/657e6a73/attachment.pgp>


More information about the Devel mailing list