Optimized a bit.

This commit is contained in:
Syoyo Fujita
2016-05-14 17:25:36 +09:00
parent bf626b5809
commit 654e686079

View File

@@ -271,7 +271,7 @@ static inline int my_atoi( const char *c ) {
if( *c == '-' ) sign = -1;
c++;
}
while ( isdigit( *c ) ) {
while ( ((*c) >= '0') && ((*c) <= '9') ) { // isdigit(*c)
value *= 10;
value += (int) (*c-'0');
c++;
@@ -596,12 +596,14 @@ typedef struct
bool parseLine(Command *command, const char *p, size_t p_len)
{
StackVector<char, 256> linebuf;
linebuf->resize(p_len + 1);
memcpy(&linebuf->at(0), p, p_len);
char linebuf[4096];
assert(p_len < 4095);
//StackVector<char, 256> linebuf;
//linebuf->resize(p_len + 1);
memcpy(&linebuf, p, p_len);
linebuf[p_len] = '\0';
const char *token = &linebuf->at(0);
const char *token = linebuf;
command->type = COMMAND_EMPTY;