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

Function ng_fixedstring_parse

freebsd/netgraph/ng_parse.c:780–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

778 ************************************************************************/
779
780static int
781ng_fixedstring_parse(const struct ng_parse_type *type,
782 const char *s, int *off, const u_char *const start,
783 u_char *const buf, int *buflen)
784{
785 const struct ng_parse_fixedstring_info *const fi = type->info;
786 char *sval;
787 int len;
788 int slen;
789
790 if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL)
791 return (EINVAL);
792 if (slen + 1 > fi->bufSize) {
793 free(sval, M_NETGRAPH_PARSE);
794 return (E2BIG);
795 }
796 *off += len;
797 bcopy(sval, buf, slen);
798 free(sval, M_NETGRAPH_PARSE);
799 bzero(buf + slen, fi->bufSize - slen);
800 *buflen = fi->bufSize;
801 return (0);
802}
803
804static int
805ng_fixedstring_unparse(const struct ng_parse_type *type,

Callers

nothing calls this directly

Calls 3

ng_get_string_tokenFunction · 0.85
bzeroFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected