xref: /openbsd-src/regress/lib/libcrypto/free/freenull.awk (revision 21b7c6ba441a1e5ca9acb392440b151ccd0c21c5)
1*21b7c6baStb# $OpenBSD: freenull.awk,v 1.4 2023/11/19 13:11:06 tb Exp $
2444db0adStb# Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
3444db0adStb#
4444db0adStb# Permission to use, copy, modify, and distribute this software for any
5444db0adStb# purpose with or without fee is hereby granted, provided that the above
6444db0adStb# copyright notice and this permission notice appear in all copies.
7444db0adStb#
8444db0adStb# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9444db0adStb# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10444db0adStb# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11444db0adStb# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12444db0adStb# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13444db0adStb# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14444db0adStb# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15444db0adStb
16444db0adStb# usage: awk -f freenull.awk < Symbols.list > freenull.c.body
17444db0adStb
18444db0adStb# Skip this function because it calls abort(3).
19444db0adStb/^CRYPTO_dbg_free/ {
20444db0adStb	next
21444db0adStb}
22444db0adStb
23444db0adStb# Skip *_free functions that take more than one or no argument.
24444db0adStb/^ASN1_item_ex_free$/				||
25444db0adStb/^ASN1_item_free$/				||
26444db0adStb/^CONF_modules_free$/				||
27444db0adStb/^EVP_PKEY_asn1_set_free$/			||
28444db0adStb/^X509V3_section_free$/				||
29444db0adStb/^X509V3_string_free$/				||
30444db0adStb/^sk_pop_free$/ {
31444db0adStb	next
32444db0adStb}
33444db0adStb
34444db0adStb# Skip functions that are prototyped in a .c file.
35444db0adStb/^BIO_CONNECT_free$/				||
36444db0adStb/^CRYPTO_free$/					||
37444db0adStb/^EC_PRIVATEKEY_free$/				||
38444db0adStb/^ECPARAMETERS_free$/				||
39444db0adStb/^ECPKPARAMETERS_free$/				||
40444db0adStb/^X9_62_CHARACTERISTIC_TWO_free$/		||
41444db0adStb/^X9_62_PENTANOMIAL_free$/ {
42444db0adStb	next
43444db0adStb}
44444db0adStb
45444db0adStb/_free$/ {
46444db0adStb	printf("\t%s(NULL);\n", $0)
47444db0adStb}
48