1# $OpenBSD: freenull.awk,v 1.4 2023/11/19 13:11:06 tb Exp $ 2# Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 3# 4# Permission to use, copy, modify, and distribute this software for any 5# purpose with or without fee is hereby granted, provided that the above 6# copyright notice and this permission notice appear in all copies. 7# 8# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 16# usage: awk -f freenull.awk < Symbols.list > freenull.c.body 17 18# Skip this function because it calls abort(3). 19/^CRYPTO_dbg_free/ { 20 next 21} 22 23# Skip *_free functions that take more than one or no argument. 24/^ASN1_item_ex_free$/ || 25/^ASN1_item_free$/ || 26/^CONF_modules_free$/ || 27/^EVP_PKEY_asn1_set_free$/ || 28/^X509V3_section_free$/ || 29/^X509V3_string_free$/ || 30/^sk_pop_free$/ { 31 next 32} 33 34# Skip functions that are prototyped in a .c file. 35/^BIO_CONNECT_free$/ || 36/^CRYPTO_free$/ || 37/^EC_PRIVATEKEY_free$/ || 38/^ECPARAMETERS_free$/ || 39/^ECPKPARAMETERS_free$/ || 40/^X9_62_CHARACTERISTIC_TWO_free$/ || 41/^X9_62_PENTANOMIAL_free$/ { 42 next 43} 44 45/_free$/ { 46 printf("\t%s(NULL);\n", $0) 47} 48