MCPcopy Index your code
hub / github.com/git/git / git_parse_double

Function git_parse_double

parse.c:137–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137int git_parse_double(const char *value, double *ret)
138{
139 char *end;
140 double val;
141 uintmax_t factor;
142
143 if (!value || !*value) {
144 errno = EINVAL;
145 return 0;
146 }
147
148 errno = 0;
149 val = strtod(value, &end);
150 if (errno == ERANGE)
151 return 0;
152 if (end == value) {
153 errno = EINVAL;
154 return 0;
155 }
156 factor = get_unit_factor(end);
157 if (!factor) {
158 errno = EINVAL;
159 return 0;
160 }
161 val *= factor;
162 *ret = val;
163 return 1;
164}
165
166int git_parse_maybe_bool_text(const char *value)
167{

Callers 1

git_config_doubleFunction · 0.85

Calls 1

get_unit_factorFunction · 0.85

Tested by

no test coverage detected