Parse the numeric value of "importance" out of a properties_json blob. * Returns a sentinel (-999.0) when the key is absent — callers that care about * presence assert on imp_key_count() instead. */
| 45 | * Returns a sentinel (-999.0) when the key is absent — callers that care about |
| 46 | * presence assert on imp_key_count() instead. */ |
| 47 | static double imp_value(const char *json) { |
| 48 | if (!json) { |
| 49 | return -999.0; |
| 50 | } |
| 51 | const char *p = strstr(json, "\"importance\":"); |
| 52 | if (!p) { |
| 53 | return -999.0; |
| 54 | } |
| 55 | return strtod(p + strlen("\"importance\":"), NULL); |
| 56 | } |
| 57 | |
| 58 | /* How many times the key appears. The duplicate-key corruption this suite |
| 59 | * guards against shows up here as 2. */ |
no outgoing calls
no test coverage detected