aboutsummaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2016-09-01 13:14:56 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2016-09-01 13:14:56 -0300
commit3b91b07fd9b6e8eb7ee7a00fb378925b755f435f (patch)
treee8316af81b98610ef52dea0327399bddbfb91589 /liolib.c
parent349badabc19e02a96f4620d7de7724442cd9e0a0 (diff)
downloadlua-3b91b07fd9b6e8eb7ee7a00fb378925b755f435f.tar.gz
lua-3b91b07fd9b6e8eb7ee7a00fb378925b755f435f.tar.bz2
lua-3b91b07fd9b6e8eb7ee7a00fb378925b755f435f.zip
detail (macro 'l_checkmode' reimplemented as function)
Diffstat (limited to 'liolib.c')
-rw-r--r--liolib.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/liolib.c b/liolib.c
index f885be25..db2f01c2 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.148 2015/11/23 11:36:11 roberto Exp roberto $ 2** $Id: liolib.c,v 2.149 2016/05/02 14:03:19 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -37,10 +37,11 @@
37#endif 37#endif
38 38
39/* Check whether 'mode' matches '[rwa]%+?[L_MODEEXT]*' */ 39/* Check whether 'mode' matches '[rwa]%+?[L_MODEEXT]*' */
40#define l_checkmode(mode) \ 40static int l_checkmode (const char *mode) {
41 (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && \ 41 return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL &&
42 (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */ \ 42 (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */
43 (strspn(mode, L_MODEEXT) == strlen(mode))) 43 (strspn(mode, L_MODEEXT) == strlen(mode))); /* check extensions */
44}
44 45
45#endif 46#endif
46 47