From 361e30450c5a6c8c3c18bac041ac1afc15f76d02 Mon Sep 17 00:00:00 2001 From: Ryan Long Date: Wed, 20 Oct 2021 10:11:34 -0400 Subject: Target: Convert to C++ --- tester/covoar/Target_arm.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tester/covoar/Target_arm.cc') diff --git a/tester/covoar/Target_arm.cc b/tester/covoar/Target_arm.cc index 94d50bb..50c9ce3 100644 --- a/tester/covoar/Target_arm.cc +++ b/tester/covoar/Target_arm.cc @@ -82,26 +82,28 @@ namespace Target { } bool Target_arm::isNopLine( - const char* const line, - int& size + const std::string& line, + int& size ) { - if (!strcmp( &line[strlen(line)-3], "nop")) { + size_t stringLen = line.length(); + + if ( line.substr( stringLen - 3 ) == "nop" ) { size = 4; return true; } // On ARM, there are literal tables at the end of methods. // We need to avoid them. - if (!strncmp( &line[strlen(line)-10], ".byte", 5)) { + if ( line.substr( stringLen - 10, 5 ) == ".byte" ) { size = 1; return true; } - if (!strncmp( &line[strlen(line)-13], ".short", 6)) { + if ( line.substr( stringLen - 13, 6 ) == ".short" ) { size = 2; return true; } - if (!strncmp( &line[strlen(line)-16], ".word", 5)) { + if ( line.substr( stringLen - 16, 5 ) == ".word" ) { size = 4; return true; } @@ -111,7 +113,7 @@ namespace Target { } bool Target_arm::isBranch( - const char* instruction + const std::string& instruction ) { throw rld::error( -- cgit v1.2.3