Parse a decimal index string via strtol, returning CBM_NOT_FOUND on parse * failure. Centralizes the atoi-replacement pattern for token_map lookups. */
| 1431 | /* Parse a decimal index string via strtol, returning CBM_NOT_FOUND on parse |
| 1432 | * failure. Centralizes the atoi-replacement pattern for token_map lookups. */ |
| 1433 | static int parse_token_index(const char *idx_str) { |
| 1434 | if (!idx_str) { |
| 1435 | return CBM_NOT_FOUND; |
| 1436 | } |
| 1437 | char *end = NULL; |
| 1438 | long parsed = strtol(idx_str, &end, BASE_DECIMAL); |
| 1439 | return (end != idx_str) ? (int)parsed : CBM_NOT_FOUND; |
| 1440 | } |
| 1441 | |
| 1442 | float cbm_sem_corpus_idf(const cbm_sem_corpus_t *corpus, const char *token) { |
| 1443 | if (!corpus || !token || corpus->doc_count == 0) { |
no outgoing calls
no test coverage detected