| 4149 | |
| 4150 | |
| 4151 | Label *Script::FindLabel(LPTSTR aLabelName) |
| 4152 | // Returns the first label whose name matches aLabelName, or NULL if not found. |
| 4153 | |
| 4154 | // If duplicates labels are now possible, callers must be aware that only the first match is returned. |
| 4155 | // This helps performance by requiring on average only half the labels to be searched before |
| 4156 | // a match is found. |
| 4157 | { |
| 4158 | if (!aLabelName || !*aLabelName) return NULL; |
| 4159 | Label *label; |
| 4160 | if (g->CurrentFunc) |
| 4161 | label = g->CurrentFunc->mFirstLabel; // Search only local labels, since global labels aren't valid jump targets in this case. |
| 4162 | else |
| 4163 | label = mFirstLabel; |
| 4164 | for ( ; label; label = label->mNextLabel) |
| 4165 | if (!_tcsicmp(label->mName, aLabelName)) // lstrcmpi() is not used: 1) avoids breaking existing scripts; 2) provides consistent behavior across multiple locales; 3) performance. |
| 4166 | return label; // Match found. |
| 4167 | return NULL; // No match found. |
| 4168 | } |
| 4169 | |
| 4170 | |
| 4171 |
no outgoing calls
no test coverage detected