diff options
author | des <des@FreeBSD.org> | 2008-10-23 15:53:51 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2008-10-23 15:53:51 +0000 |
commit | 66f807ed8b3634dc73d9f7526c484e43f094c0ee (patch) | |
tree | 21e792ce590e1bcf9b343890605a1b4c6a9016b3 /sys/netgraph/ng_parse.c | |
parent | a779c60ce0a41cd14710a8a12cfa22955108b27a (diff) | |
download | FreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.zip FreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.tar.gz |
Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after: 3 months
Diffstat (limited to 'sys/netgraph/ng_parse.c')
-rw-r--r-- | sys/netgraph/ng_parse.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/sys/netgraph/ng_parse.c b/sys/netgraph/ng_parse.c index 2c46d5c..1215df1 100644 --- a/sys/netgraph/ng_parse.c +++ b/sys/netgraph/ng_parse.c @@ -740,7 +740,7 @@ ng_string_parse(const struct ng_parse_type *type, return (EINVAL); *off += len; bcopy(sval, buf, slen + 1); - FREE(sval, M_NETGRAPH_PARSE); + free(sval, M_NETGRAPH_PARSE); *buflen = slen + 1; return (0); } @@ -756,11 +756,11 @@ ng_string_unparse(const struct ng_parse_type *type, if (s == NULL) return (ENOMEM); if ((error = ng_parse_append(&cbuf, &cbuflen, "%s", s)) != 0) { - FREE(s, M_NETGRAPH_PARSE); + free(s, M_NETGRAPH_PARSE); return (error); } *off += strlen(raw) + 1; - FREE(s, M_NETGRAPH_PARSE); + free(s, M_NETGRAPH_PARSE); return (0); } @@ -803,12 +803,12 @@ ng_fixedstring_parse(const struct ng_parse_type *type, if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) return (EINVAL); if (slen + 1 > fi->bufSize) { - FREE(sval, M_NETGRAPH_PARSE); + free(sval, M_NETGRAPH_PARSE); return (E2BIG); } *off += len; bcopy(sval, buf, slen); - FREE(sval, M_NETGRAPH_PARSE); + free(sval, M_NETGRAPH_PARSE); bzero(buf + slen, fi->bufSize - slen); *buflen = fi->bufSize; return (0); @@ -906,13 +906,13 @@ ng_sizedstring_parse(const struct ng_parse_type *type, if ((sval = ng_get_string_token(s, off, &len, &slen)) == NULL) return (EINVAL); if (slen > USHRT_MAX) { - FREE(sval, M_NETGRAPH_PARSE); + free(sval, M_NETGRAPH_PARSE); return (EINVAL); } *off += len; *((u_int16_t *)buf) = (u_int16_t)slen; bcopy(sval, buf + 2, slen); - FREE(sval, M_NETGRAPH_PARSE); + free(sval, M_NETGRAPH_PARSE); *buflen = 2 + slen; return (0); } @@ -929,10 +929,10 @@ ng_sizedstring_unparse(const struct ng_parse_type *type, if (s == NULL) return (ENOMEM); if ((error = ng_parse_append(&cbuf, &cbuflen, "%s", s)) != 0) { - FREE(s, M_NETGRAPH_PARSE); + free(s, M_NETGRAPH_PARSE); return (error); } - FREE(s, M_NETGRAPH_PARSE); + free(s, M_NETGRAPH_PARSE); *off += slen + 2; return (0); } @@ -1117,16 +1117,16 @@ ng_bytearray_parse(const struct ng_parse_type *type, arraylen = (*getLength)(type, start, buf); if (arraylen > *buflen) { - FREE(str, M_NETGRAPH_PARSE); + free(str, M_NETGRAPH_PARSE); return (ERANGE); } if (slen > arraylen) { - FREE(str, M_NETGRAPH_PARSE); + free(str, M_NETGRAPH_PARSE); return (E2BIG); } bcopy(str, buf, slen); bzero(buf + slen, arraylen - slen); - FREE(str, M_NETGRAPH_PARSE); + free(str, M_NETGRAPH_PARSE); *off += toklen; *buflen = arraylen; return (0); @@ -1219,7 +1219,7 @@ ng_parse_composite(const struct ng_parse_type *type, const char *s, int align, len, blen, error = 0; /* Initialize */ - MALLOC(foff, int *, num * sizeof(*foff), M_NETGRAPH_PARSE, M_NOWAIT | M_ZERO); + foff = malloc(num * sizeof(*foff), M_NETGRAPH_PARSE, M_NOWAIT | M_ZERO); if (foff == NULL) { error = ENOMEM; goto done; @@ -1375,7 +1375,7 @@ gotIndex: *buflen = blen; done: if (foff != NULL) - FREE(foff, M_NETGRAPH_PARSE); + free(foff, M_NETGRAPH_PARSE); return (error); } @@ -1395,7 +1395,7 @@ ng_unparse_composite(const struct ng_parse_type *type, const u_char *data, u_char *workBuf; /* Get workspace for checking default values */ - MALLOC(workBuf, u_char *, workSize, M_NETGRAPH_PARSE, M_NOWAIT); + workBuf = malloc(workSize, M_NETGRAPH_PARSE, M_NOWAIT); if (workBuf == NULL) return (ENOMEM); @@ -1453,7 +1453,7 @@ ng_unparse_composite(const struct ng_parse_type *type, const u_char *data, /* Print value */ if ((error = INVOKE(etype, unparse) (etype, data, off, cbuf, cbuflen)) != 0) { - FREE(workBuf, M_NETGRAPH_PARSE); + free(workBuf, M_NETGRAPH_PARSE); return (error); } cbuflen -= strlen(cbuf); @@ -1467,7 +1467,7 @@ ng_unparse_composite(const struct ng_parse_type *type, const u_char *data, fail: /* Clean up after failure */ - FREE(workBuf, M_NETGRAPH_PARSE); + free(workBuf, M_NETGRAPH_PARSE); return (error); } @@ -1717,7 +1717,7 @@ ng_parse_get_token(const char *s, int *startp, int *lenp) case '"': if ((t = ng_get_string_token(s, startp, lenp, NULL)) == NULL) return T_ERROR; - FREE(t, M_NETGRAPH_PARSE); + free(t, M_NETGRAPH_PARSE); return T_STRING; default: for (i = *startp + 1; s[i] != '\0' && !isspace(s[i]) @@ -1745,7 +1745,7 @@ ng_get_string_token(const char *s, int *startp, int *lenp, int *slenp) start = *startp; if (s[*startp] != '"') return (NULL); - MALLOC(cbuf, char *, strlen(s + start), M_NETGRAPH_PARSE, M_NOWAIT); + cbuf = malloc(strlen(s + start), M_NETGRAPH_PARSE, M_NOWAIT); if (cbuf == NULL) return (NULL); strcpy(cbuf, s + start + 1); @@ -1812,7 +1812,7 @@ ng_get_string_token(const char *s, int *startp, int *lenp, int *slenp) strcpy(p, v); } } - FREE(cbuf, M_NETGRAPH_PARSE); + free(cbuf, M_NETGRAPH_PARSE); return (NULL); /* no closing quote */ } @@ -1828,7 +1828,7 @@ ng_encode_string(const char *raw, int slen) int off = 0; int i; - MALLOC(cbuf, char *, strlen(raw) * 4 + 3, M_NETGRAPH_PARSE, M_NOWAIT); + cbuf = malloc(strlen(raw) * 4 + 3, M_NETGRAPH_PARSE, M_NOWAIT); if (cbuf == NULL) return (NULL); cbuf[off++] = '"'; |