MCPcopy Index your code
hub / github.com/F-Stack/f-stack / ng_parse_skip_value

Function ng_parse_skip_value

freebsd/netgraph/ng_parse.c:1640–1672  ·  view source on GitHub ↗

* Skip over a value */

Source from the content-addressed store, hash-verified

1638 * Skip over a value
1639 */
1640static int
1641ng_parse_skip_value(const char *s, int off0, int *lenp)
1642{
1643 int len, nbracket, nbrace;
1644 int off = off0;
1645
1646 len = nbracket = nbrace = 0;
1647 do {
1648 switch (ng_parse_get_token(s, &off, &len)) {
1649 case T_LBRACKET:
1650 nbracket++;
1651 break;
1652 case T_LBRACE:
1653 nbrace++;
1654 break;
1655 case T_RBRACKET:
1656 if (nbracket-- == 0)
1657 return (EINVAL);
1658 break;
1659 case T_RBRACE:
1660 if (nbrace-- == 0)
1661 return (EINVAL);
1662 break;
1663 case T_EOF:
1664 return (EINVAL);
1665 default:
1666 break;
1667 }
1668 off += len;
1669 } while (nbracket > 0 || nbrace > 0);
1670 *lenp = off - off0;
1671 return (0);
1672}
1673
1674/*
1675 * Find the next token in the string, starting at offset *startp.

Callers 1

ng_parse_compositeFunction · 0.85

Calls 1

ng_parse_get_tokenFunction · 0.85

Tested by

no test coverage detected