Convert a null-terminated string to an integer. This function is async signal safe since it does not make any libc calls.
| 60 | // Convert a null-terminated string to an integer. This function |
| 61 | // is async signal safe since it does not make any libc calls. |
| 62 | static 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 |
no outgoing calls
no test coverage detected