diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/tools/ragel6/rlscan.rl | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/ragel6/rlscan.rl')
-rw-r--r-- | contrib/tools/ragel6/rlscan.rl | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/tools/ragel6/rlscan.rl b/contrib/tools/ragel6/rlscan.rl index c3217f1542..d8c0c2b5d2 100644 --- a/contrib/tools/ragel6/rlscan.rl +++ b/contrib/tools/ragel6/rlscan.rl @@ -1,6 +1,6 @@ /* * Copyright 2006-2007 Adrian Thurston <thurston@complang.org> - * Copyright 2011 Josef Goettgens + * Copyright 2011 Josef Goettgens */ /* This file is part of Ragel. @@ -548,18 +548,18 @@ bool isAbsolutePath( const char *path ) #endif } -inline char* resolvePath(const char* rel, const char* abs) { - const size_t l1 = strlen(rel); - const size_t l2 = strlen(abs); - char* ret = new char[l1 + l2 + 1]; - - const char* p = strrchr(abs, '/') + 1; - const size_t l3 = p - abs; - - memcpy(ret, abs, l3); - strcpy(ret + l3, rel); - - return ret; +inline char* resolvePath(const char* rel, const char* abs) { + const size_t l1 = strlen(rel); + const size_t l2 = strlen(abs); + char* ret = new char[l1 + l2 + 1]; + + const char* p = strrchr(abs, '/') + 1; + const size_t l3 = p - abs; + + memcpy(ret, abs, l3); + strcpy(ret + l3, rel); + + return ret; } char **Scanner::makeIncludePathChecks( const char *thisFileName, @@ -585,7 +585,7 @@ char **Scanner::makeIncludePathChecks( const char *thisFileName, if ( lastSlash == 0 ) checks[nextCheck++] = data; else { - checks[nextCheck++] = resolvePath(data, thisFileName); + checks[nextCheck++] = resolvePath(data, thisFileName); } /* Search from the include paths given on the command line. */ @@ -616,16 +616,16 @@ ifstream *Scanner::tryOpenInclude( char **pathChecks, long &found ) found = check - pathChecks; return inFile; } - - /* - * 03/26/2011 jg: - * Don't rely on sloppy runtime behaviour: reset the state of the stream explicitly. - * If inFile->open() fails, which happens when include dirs are tested, the fail bit - * is set by the runtime library. Currently the VS runtime library opens new files, - * but when it comes to reading it refuses to work. - */ - inFile->clear(); - + + /* + * 03/26/2011 jg: + * Don't rely on sloppy runtime behaviour: reset the state of the stream explicitly. + * If inFile->open() fails, which happens when include dirs are tested, the fail bit + * is set by the runtime library. Currently the VS runtime library opens new files, + * but when it comes to reading it refuses to work. + */ + inFile->clear(); + check += 1; } |