lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Thanks very much Folks, I'll try and put those fixes in next time I update the code!
David Jones wrote:

In message <bnoobt$nhg$>, Philipp Janda writes:
as we noted some time ago, the LuaCheia code has had this functionality. The code is still there, but currently not used (as it is pending to be made into a module)
I spotted a minor bug in the code above:

#define LC_ISPATHSEP(C) (C=="/" ? 1 : 0 )
should probably be C=='/' or strcmp( C, "/" )!=0

And the same for
#define LC_ISPATHSEP(C) (C!="\\" ? (C=="/" ? 1 : 0 ) : 1)
                         ^^^^^^^    ^^^^^^
#define LC_ISPATHSEP(C) (C==":" ? 1 : 0 )

I realise this is a lua list not a C list but aren't the above (aside
from the bug you pointed out) better written as:

#define LC_ISPATHSEP(C) ((C)=='/')
#define LC_ISPATHSEP(C) ((C)=='\\'||(C)=='/')
#define LC_ISPATHSEP(C) ((C)==':')

The middle one has a multiple evaluation issue which I won't bother