Return whether str[] conatins a string with prefix "macro_name="; if so, set *pvalue to the suffix.
| 58 | // Return whether str[] conatins a string with prefix "macro_name="; if so, |
| 59 | // set *pvalue to the suffix. |
| 60 | static bool GetValue(const string_vec &str, const std::string ¯o_name, |
| 61 | std::string *pvalue) { |
| 62 | std::string nam_eq = macro_name + "="; |
| 63 | int i = 0; |
| 64 | while (i != str.size() && !absl::StartsWith(str[i], nam_eq)) { |
| 65 | i++; |
| 66 | } |
| 67 | bool found = (i != str.size()); |
| 68 | if (found) { |
| 69 | *pvalue = str[i].substr(nam_eq.size()); |
| 70 | } |
| 71 | return found; |
| 72 | } |
| 73 | |
| 74 | // If macro_name[] is not equal to value[], check that str[] contains the |
| 75 | // string "macro_name=value". Otherwise, check that str[] does not contain any |
no test coverage detected