_buf is always within [buf, buf_end) upon success */
| 203 | |
| 204 | /* *_buf is always within [buf, buf_end) upon success */ |
| 205 | static const char *parse_int(const char *buf, const char *buf_end, int *value, |
| 206 | int *ret) { |
| 207 | int v; |
| 208 | CHECK_EOF(); |
| 209 | if (!('0' <= *buf && *buf <= '9')) { |
| 210 | *ret = -1; |
| 211 | return NULL; |
| 212 | } |
| 213 | v = 0; |
| 214 | for (;; ++buf) { |
| 215 | CHECK_EOF(); |
| 216 | if ('0' <= *buf && *buf <= '9') { |
| 217 | v = v * 10 + *buf - '0'; |
| 218 | } else { |
| 219 | break; |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | *value = v; |
| 224 | return buf; |
| 225 | } |
| 226 | |
| 227 | /* returned pointer is always within [buf, buf_end), or null */ |
| 228 | static const char *parse_http_version(const char *buf, const char *buf_end, |
no outgoing calls
no test coverage detected