lua-users home
lua-l archive

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


ltolower could be enhanced with a check such as:

#define ltolower(c)     check_exp((c) >= 'A' && (c) <= 'Z' || (c) >= 'a' && (c) <= 'z', ((c) | ('A' ^ 'a')))

Running the test suite with this reveals that the following code in l_str2d is incorrect:

const char *pmode = strpbrk(s, ".xXnN");

It should be:

const char *pmode = strpbrk(s, "xXnN");

Due to the following line calling ltolower:

int mode = pmode ? ltolower(cast_uchar(*pmode)) : 0;

Note: this doesn't change the code's behavior at all, because 0 is equivalent to '.' (or 46, which is the value returned by ltolower('.')) when doing the subsequent checks against mode. It's mostly just cause for confusion.

Thanks.