MCPcopy Create free account
hub / github.com/NetSys/bess / parse_int

Function parse_int

core/utils/http_parser.cc:205–225  ·  view source on GitHub ↗

_buf is always within [buf, buf_end) upon success */

Source from the content-addressed store, hash-verified

203
204/* *_buf is always within [buf, buf_end) upon success */
205static 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 */
228static const char *parse_http_version(const char *buf, const char *buf_end,

Callers 2

parse_http_versionFunction · 0.85
parse_responseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected