MCPcopy Create free account
hub / github.com/3rdparty/libprocess / convertStringToInt

Function convertStringToInt

src/posix/subprocess.hpp:62–76  ·  view source on GitHub ↗

Convert a null-terminated string to an integer. This function is async signal safe since it does not make any libc calls.

Source from the content-addressed store, hash-verified

60// Convert a null-terminated string to an integer. This function
61// is async signal safe since it does not make any libc calls.
62static int convertStringToInt(const char *name)
63{
64 int num = 0;
65 while (*name >= '0' && *name <= '9') {
66 num = num * 10 + (*name - '0');
67 ++name;
68 }
69
70 if (*name) {
71 // Non digit found, not a number.
72 return -1;
73 }
74
75 return num;
76}
77#endif // __linux__ && SYS_getdents64
78
79

Callers 1

handleWhitelistFdsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected