Parse a decimal index string via strtol, returning CBM_NOT_FOUND on parse * failure. Centralizes the atoi-replacement pattern for token_map lookups. */
| 1457 | /* Parse a decimal index string via strtol, returning CBM_NOT_FOUND on parse |
| 1458 | * failure. Centralizes the atoi-replacement pattern for token_map lookups. */ |
| 1459 | static int parse_token_index(const char *idx_str) { |
| 1460 | if (!idx_str) { |
| 1461 | return CBM_NOT_FOUND; |
| 1462 | } |
| 1463 | char *end = NULL; |
| 1464 | long parsed = strtol(idx_str, &end, BASE_DECIMAL); |
| 1465 | return (end != idx_str) ? (int)parsed : CBM_NOT_FOUND; |
| 1466 | } |
| 1467 | |
| 1468 | float cbm_sem_corpus_idf(const cbm_sem_corpus_t *corpus, const char *token) { |
| 1469 | if (!corpus || !token || corpus->doc_count == 0) { |
no outgoing calls
no test coverage detected