| 46 | } |
| 47 | |
| 48 | const IFaceFunction *IFaceTable::FindFunctionByConstantName(const char *name) const { |
| 49 | if (strncmp(name, prefix, strlen(prefix)) == 0) { |
| 50 | // This looks like a constant for an iface function. This requires |
| 51 | // a sequential search. Take special care since the function names |
| 52 | // are mixed case, whereas the constants are all-caps. |
| 53 | |
| 54 | for (const auto &func : functions) { |
| 55 | const char *nm = name + strlen(prefix); |
| 56 | const char *fn = func.name; |
| 57 | while (*nm && *fn && (*nm == toupper(*fn))) { |
| 58 | ++nm; |
| 59 | ++fn; |
| 60 | } |
| 61 | if (!*nm && !*fn) { |
| 62 | return &func; |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | return nullptr; |
| 67 | } |
| 68 | |
| 69 | const IFaceFunction *IFaceTable::FindFunctionByValue(int value) const { |
| 70 | for (const auto &func : functions) { |
no outgoing calls
no test coverage detected