code style in the vfs

Roland Illig roland.illig at gmx.de
Sun Sep 26 14:03:17 UTC 2004


Leonard den Ottolander wrote:
> Well something like that. slash can be modified and path with it. Of
> course there is merit in catching such cases. But I am not sure if
> introducing the macros defined by Roland into HEAD at this point is a
> good idea. Let's first do it in a separate branch, substitute all
> strrchrs by mod_strrchrs where appropriate, and merge once everything is
> fixed and properly tested.

That's what I did yesterday. I have #defined the functions 
{mem,str}{r,}chr, strpbrk, str{case,}str, gettext and getenv to return a 
const char *.

The result was that they were almost always used correctly. The few 
places where they weren't had mostly been introduced by me adding the 
"const" qualifier without thinking further. These places have been 
corrected. But it shouldn't hurt if someone else takes a look at it, too.

I will keep the additional #include file I created for it, and will 
enable it from time to time against HEAD. If you also want to try, just 
#include "constwarns.h" (attachment #1) at the end of src/global.h.

If you know of some other functions that cast-away the const qualifier, 
please let me know.

Roland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: constwarns.h
Type: text/x-chdr
Size: 826 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20040926/4b9cbe05/attachment.h>


More information about the mc-devel mailing list