mirror of
https://github.com/keystone-engine/keystone
synced 2026-06-08 15:15:30 +00:00
do not use strcasecmp() but StringRef.lower() for string comparison
This commit is contained in:
@@ -1361,10 +1361,6 @@ bool AsmParser::isDirective(StringRef IDVal)
|
||||
return (IDVal[0] == '.' && IDVal != ".");
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
/// ParseStatement:
|
||||
/// ::= EndOfStatement
|
||||
/// ::= Label* Directive ...Operands... EndOfStatement
|
||||
@@ -1425,7 +1421,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
|
||||
// [bits xx]
|
||||
Lex();
|
||||
ID = Lexer.getTok();
|
||||
if (strcasecmp(ID.getString().str().c_str(), "bits") == 0) {
|
||||
if (ID.getString().lower() == "bits") {
|
||||
Lex();
|
||||
if (parseDirectiveBits()) {
|
||||
Info.KsError = KS_ERR_ASM_DIRECTIVE_ID;
|
||||
|
||||
@@ -1273,10 +1273,6 @@ RewriteIntelBracExpression(SmallVectorImpl<AsmRewrite> &AsmRewrites,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End)
|
||||
{
|
||||
unsigned int ErrorCode;
|
||||
@@ -1836,11 +1832,11 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseIntelOperand(StringRef Mnem)
|
||||
Parser.Lex(); // Eat operand size (e.g., byte, word).
|
||||
if (KsSyntax == KS_OPT_SYNTAX_NASM) {
|
||||
// Nasm do not accept 'PTR' in memory operands
|
||||
if (strcasecmp(Tok.getString().str().c_str(), "ptr") == 0)
|
||||
if (Tok.getString().lower() == "ptr")
|
||||
return ErrorOperand(Tok.getLoc(), "Do not expected 'PTR' or 'ptr' token!");
|
||||
} else {
|
||||
// LLVM requires 'PTR' in memory operand
|
||||
if (strcasecmp(Tok.getString().str().c_str(), "ptr") != 0)
|
||||
if (Tok.getString().lower() != "ptr")
|
||||
return ErrorOperand(Tok.getLoc(), "Expected 'PTR' or 'ptr' token!");
|
||||
Parser.Lex(); // Eat ptr.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user