| 248 | } |
| 249 | |
| 250 | static bool |
| 251 | parse_unsigned(const char *str, unsigned long &lval) |
| 252 | { |
| 253 | char *end = nullptr; |
| 254 | |
| 255 | if (*str == '\0') { |
| 256 | return false; |
| 257 | } |
| 258 | |
| 259 | lval = strtoul(str, &end, 0 /* base */); |
| 260 | if (end == str) { |
| 261 | // No valid characters. |
| 262 | return false; |
| 263 | } |
| 264 | |
| 265 | if (end && *end != '\0') { |
| 266 | // Not all characters consumed. |
| 267 | return false; |
| 268 | } |
| 269 | |
| 270 | return true; |
| 271 | } |
| 272 | |
| 273 | // Parse a comma-separated list of hook names into a hook bitmask. |
| 274 | static unsigned |