Try dot-based prefix matching (Java: com.myorg.pkg.Foo). * Returns heap QN or NULL. */
| 1349 | /* Try dot-based prefix matching (Java: com.myorg.pkg.Foo). |
| 1350 | * Returns heap QN or NULL. */ |
| 1351 | static char *resolve_dot_prefix(CBMHashTable *map, const char *module_path, |
| 1352 | const char *project_name) { |
| 1353 | char *buf = strdup(module_path); |
| 1354 | if (!buf) { |
| 1355 | return NULL; |
| 1356 | } |
| 1357 | for (char *dot = buf + strlen(buf) - SKIP_ONE; dot > buf; dot--) { |
| 1358 | if (*dot != '.') { |
| 1359 | continue; |
| 1360 | } |
| 1361 | *dot = '\0'; |
| 1362 | const char *base_qn = (const char *)cbm_ht_get(map, buf); |
| 1363 | if (!base_qn) { |
| 1364 | continue; |
| 1365 | } |
| 1366 | const char *subpath = module_path + (size_t)(dot - buf) + SKIP_ONE; |
| 1367 | char subpath_slashed[PKGMAP_PATH_BUF]; |
| 1368 | snprintf(subpath_slashed, sizeof(subpath_slashed), "%s", subpath); |
| 1369 | for (char *c = subpath_slashed; *c; c++) { |
| 1370 | if (*c == '.') { |
| 1371 | *c = '/'; |
| 1372 | } |
| 1373 | } |
| 1374 | char result[PKGMAP_PATH_BUF]; |
| 1375 | snprintf(result, sizeof(result), "%s/%s", base_qn, subpath_slashed); |
| 1376 | free(buf); |
| 1377 | return cbm_pipeline_fqn_module(project_name, result); |
| 1378 | } |
| 1379 | free(buf); |
| 1380 | return NULL; |
| 1381 | } |
| 1382 | |
| 1383 | /* Try backslash-based prefix matching (PHP PSR-4: App\\Controllers\\Foo). |
| 1384 | * The map value of a PSR-4 prefix is its repo-relative directory (see |
no test coverage detected