summaryrefslogtreecommitdiff
path: root/lobject.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-01-28 13:13:26 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-01-28 13:13:26 -0200
commite2b15aa21d2f31ccc93e35f50928e26a8d9c84ce (patch)
tree0c8fe009fffa187be71ea3e268daf1a6e29d6d9a /lobject.c
parent89110986d7a9e81960261ae682780d5fd06dc4ac (diff)
downloadlua-github-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.tar.gz
janitor work on casts
Diffstat (limited to 'lobject.c')
-rw-r--r--lobject.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lobject.c b/lobject.c
index c7d4c06a..d5e9c1ce 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
/*
-** $Id: lobject.c,v 2.121 2017/11/23 19:29:04 roberto Exp roberto $
+** $Id: lobject.c,v 2.122 2017/12/30 20:46:18 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@@ -204,7 +204,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
int e = 0; /* exponent correction */
int neg; /* 1 if number is negative */
int hasdot = 0; /* true after seen a dot */
- *endptr = cast(char *, s); /* nothing is valid yet */
+ *endptr = cast_charp(s); /* nothing is valid yet */
while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */
neg = isneg(&s); /* check sign */
if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */
@@ -226,7 +226,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
}
if (nosigdig + sigdig == 0) /* no digits? */
return 0.0; /* invalid format */
- *endptr = cast(char *, s); /* valid up to here */
+ *endptr = cast_charp(s); /* valid up to here */
e *= 4; /* each digit multiplies/divides value by 2^4 */
if (*s == 'p' || *s == 'P') { /* exponent part? */
int exp1 = 0; /* exponent value */
@@ -239,7 +239,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) {
exp1 = exp1 * 10 + *(s++) - '0';
if (neg1) exp1 = -exp1;
e += exp1;
- *endptr = cast(char *, s); /* valid up to here */
+ *endptr = cast_charp(s); /* valid up to here */
}
if (neg) r = -r;
return l_mathop(ldexp)(r, e);
@@ -353,15 +353,15 @@ int luaO_utf8esc (char *buff, unsigned long x) {
int n = 1; /* number of bytes put in buffer (backwards) */
lua_assert(x <= 0x10FFFF);
if (x < 0x80) /* ascii? */
- buff[UTF8BUFFSZ - 1] = cast(char, x);
+ buff[UTF8BUFFSZ - 1] = cast_char(x);
else { /* need continuation bytes */
unsigned int mfb = 0x3f; /* maximum that fits in first byte */
do { /* add continuation bytes */
- buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f));
+ buff[UTF8BUFFSZ - (n++)] = cast_char(0x80 | (x & 0x3f));
x >>= 6; /* remove added bits */
mfb >>= 1; /* now there is one less bit available in first byte */
} while (x > mfb); /* still needs continuation byte? */
- buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */
+ buff[UTF8BUFFSZ - n] = cast_char((~mfb << 1) | x); /* add first byte */
}
return n;
}
@@ -417,7 +417,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
break;
}
case 'c': { /* an 'int' as a character */
- char buff = cast(char, va_arg(argp, int));
+ char buff = cast_char(va_arg(argp, int));
if (lisprint(cast_uchar(buff)))
pushstr(L, &buff, 1);
else /* non-printable character; print its code */