[Geany-devel] Changes to templates

Lex Trotman elextr at xxxxx
Sun Mar 13 10:19:30 UTC 2011

On 13 March 2011 19:18, Matthew Brush <matthewbrush at gmail.com> wrote:
> Hi,
> I wasn't sure if I should make a feature request or a bug report, so if
> needed, let me know which and I'll file it on the project site.
> The patch attached to this message does a few things, sorry I didn't split
> them into different patches, but it's so small and related that it's hardly
> worth it.
> Here's what the patch does:
> #1
> --
> Makes the indent parameter value used for calls to make_comment_block() a
> "global", so that it's settable from a single location.  It also makes it 3
> instead of 8, where before it was 3 for function templates, and 8 for
> license and fileheader.  I guess it's a matter of taste on this value, but
> IMHO, 8 is just too much.  This is related to feature request 'Specify
> spacing before fileheader - ID: 3193527'[1].
> #2
> --
> Strips whitespace from the start and end of the templates before passing to
> make_comment_block() so that trailing newlines are consistent.  I'm not sure
> if this is desired or not, but I think the resulting comment looks better
> than before where there was 2 empty comment lines before the closing */.
>  I'm also not sure if the 3 calls to g_strstrip() should be just a single
> call inside the make_comment_block() function. Also, not being very familiar
> with GString, I'm not 100% sure if calling g_strstrip() on the ->str member
> behind its back is OK, but it seems fine since g_strstrip() changes the
> string in place without changing the amount of memory used.

I don't think this is a good idea since g_strstrip() doesn't actually
change the size recorded in the GString, it might appear to work
sometimes but it might also fail. Note that a GString also does not
have to be null terminated so the g_strstrip might write beyond the
buffer if you are unlucky.  I think you are better not to do this.

> #3
> --
> Change filetypes.c to use /* */ style comments rather than // style, to
> prevent those ISO C90 warnings from GCC.  It's probably best to make the
> default for C not be C++ style comments.

Sounds a good idea.

> With the small amount of testing I've done, it seems to all work fine.

I havn't the chance to test it, but so long as you don't muck up my
personalised templates its ok :-)


> [1]
> https://sourceforge.net/tracker/?func=detail&aid=3193527&group_id=153444&atid=787794
> Cheers,
> Matthew Brush (codebrainz)
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel

More information about the Devel mailing list