MCPcopy Create free account
hub / github.com/ddnet/ddnet / parse_int

Function parse_int

src/base/net.cpp:304–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304static int parse_int(int *out, const char **str)
305{
306 int i = 0;
307 *out = 0;
308 if(!str_isnum(**str))
309 return -1;
310
311 i = **str - '0';
312 (*str)++;
313
314 while(true)
315 {
316 if(!str_isnum(**str))
317 {
318 *out = i;
319 return 0;
320 }
321
322 i = (i * 10) + (**str - '0');
323 (*str)++;
324 }
325
326 return 0;
327}
328
329static int parse_char(char c, const char **str)
330{

Callers 2

parse_uint8Function · 0.85
parse_uint16Function · 0.85

Calls 1

str_isnumFunction · 0.85

Tested by

no test coverage detected