… | |
… | |
225 | * is because of the 'else' handling - we don't want to match on |
225 | * is because of the 'else' handling - we don't want to match on |
226 | * something and set a low retval, even though it may match a higher retcal |
226 | * something and set a low retval, even though it may match a higher retcal |
227 | * later. So keep it in descending order here, so we try for the best |
227 | * later. So keep it in descending order here, so we try for the best |
228 | * match first, and work downward. |
228 | * match first, and work downward. |
229 | */ |
229 | */ |
|
|
230 | const char *qbn0, *qbn1, *qsn; // query base name/short name caches |
|
|
231 | |
230 | if (!strcasecmp (cp, query_name (op))) |
232 | if (!strcasecmp (cp, query_name (op))) |
231 | retval = 20; |
233 | retval = 20; |
232 | else if (!strcasecmp (cp, query_short_name (op))) |
234 | else if (!strcasecmp (cp, qsn = query_short_name (op))) |
233 | retval = 18; |
235 | retval = 18; |
234 | else if (!strcasecmp (cp, query_base_name (op, 0))) |
236 | else if (!strcasecmp (cp, qbn0 = query_base_name (op, 0))) |
235 | retval = 16; |
237 | retval = 16; |
236 | else if (!strcasecmp (cp, query_base_name (op, 1))) |
238 | else if (!strcasecmp (cp, qbn1 = query_base_name (op, 1))) |
237 | retval = 16; |
239 | retval = 16; |
238 | else if (op->custom_name && !strcasecmp (cp, op->custom_name)) |
240 | else if (op->custom_name && !strcasecmp (cp, op->custom_name)) |
239 | retval = 15; |
241 | retval = 15; |
240 | else if (!strncasecmp (cp, query_base_name (op, 0), strlen (cp))) |
242 | else if (!strncasecmp (cp, qbn0, strlen (cp))) |
241 | retval = 14; |
243 | retval = 14; |
242 | else if (!strncasecmp (cp, query_base_name (op, 1), strlen (cp))) |
244 | else if (!strncasecmp (cp, qbn1, strlen (cp))) |
243 | retval = 14; |
245 | retval = 14; |
244 | /* Do substring checks, so things like 'Str+1' will match. |
246 | /* Do substring checks, so things like 'Str+1' will match. |
245 | * retval of these should perhaps be lower - they are lower |
247 | * retval of these should perhaps be lower - they are lower |
246 | * then the specific strcasecmp aboves, but still higher than |
248 | * then the specific strcasecmp aboves, but still higher than |
247 | * some other match criteria. |
249 | * some other match criteria. |
248 | */ |
250 | */ |
249 | else if (strstr (query_base_name (op, 1), cp)) |
251 | else if (strstr (qbn1, cp)) |
250 | retval = 12; |
252 | retval = 12; |
251 | else if (strstr (query_base_name (op, 0), cp)) |
253 | else if (strstr (qbn0, cp)) |
252 | retval = 12; |
254 | retval = 12; |
253 | else if (strstr (query_short_name (op), cp)) |
255 | else if (strstr (qsn, cp)) |
254 | retval = 12; |
256 | retval = 12; |
255 | /* Check against plural/non plural based on count. */ |
257 | /* Check against plural/non plural based on count. */ |
256 | else if (count > 1 && !strcasecmp (cp, op->name_pl)) |
258 | else if (count > 1 && !strcasecmp (cp, op->name_pl)) |
257 | retval = 6; |
259 | retval = 6; |
258 | else if (count == 1 && !strcasecmp (op->name, cp)) |
260 | else if (count == 1 && !strcasecmp (op->name, cp)) |