From 6c965e26b1a93da63948edae6b68564be1ded507 Mon Sep 17 00:00:00 2001 From: tb <> Date: Mon, 6 Mar 2023 14:32:06 +0000 Subject: Rename struct ${app}_config to plain cfg All the structs are static and we need to reach into them many times. Having a shorter name is more concise and results in less visual clutter. It also avoids many overlong lines and we will be able to get rid of some unfortunate line wrapping down the road. Discussed with jsing --- src/usr.bin/openssl/pkeyparam.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/usr.bin/openssl/pkeyparam.c') diff --git a/src/usr.bin/openssl/pkeyparam.c b/src/usr.bin/openssl/pkeyparam.c index 57b5ad8042..946195640e 100644 --- a/src/usr.bin/openssl/pkeyparam.c +++ b/src/usr.bin/openssl/pkeyparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkeyparam.c,v 1.16 2023/03/05 13:12:53 tb Exp $ */ +/* $OpenBSD: pkeyparam.c,v 1.17 2023/03/06 14:32:06 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006 */ @@ -71,40 +71,40 @@ static struct { int noout; char *outfile; int text; -} pkeyparam_config; +} cfg; static const struct option pkeyparam_options[] = { { .name = "check", .desc = "Check validity of key parameters", .type = OPTION_FLAG, - .opt.flag = &pkeyparam_config.check, + .opt.flag = &cfg.check, }, { .name = "in", .argname = "file", .desc = "Input file (default stdin)", .type = OPTION_ARG, - .opt.arg = &pkeyparam_config.infile, + .opt.arg = &cfg.infile, }, { .name = "noout", .desc = "Do not print encoded version of the parameters", .type = OPTION_FLAG, - .opt.flag = &pkeyparam_config.noout, + .opt.flag = &cfg.noout, }, { .name = "out", .argname = "file", .desc = "Output file (default stdout)", .type = OPTION_ARG, - .opt.arg = &pkeyparam_config.outfile, + .opt.arg = &cfg.outfile, }, { .name = "text", .desc = "Print out the parameters in plain text", .type = OPTION_FLAG, - .opt.flag = &pkeyparam_config.text, + .opt.flag = &cfg.text, }, { NULL }, }; @@ -130,26 +130,26 @@ pkeyparam_main(int argc, char **argv) exit(1); } - memset(&pkeyparam_config, 0, sizeof(pkeyparam_config)); + memset(&cfg, 0, sizeof(cfg)); if (options_parse(argc, argv, pkeyparam_options, NULL, NULL) != 0) { pkeyparam_usage(); return (1); } - if (pkeyparam_config.infile) { - if (!(in = BIO_new_file(pkeyparam_config.infile, "r"))) { + if (cfg.infile) { + if (!(in = BIO_new_file(cfg.infile, "r"))) { BIO_printf(bio_err, "Can't open input file %s\n", - pkeyparam_config.infile); + cfg.infile); goto end; } } else in = BIO_new_fp(stdin, BIO_NOCLOSE); - if (pkeyparam_config.outfile) { - if (!(out = BIO_new_file(pkeyparam_config.outfile, "w"))) { + if (cfg.outfile) { + if (!(out = BIO_new_file(cfg.outfile, "w"))) { BIO_printf(bio_err, "Can't open output file %s\n", - pkeyparam_config.outfile); + cfg.outfile); goto end; } } else { @@ -163,15 +163,15 @@ pkeyparam_main(int argc, char **argv) goto end; } - if (pkeyparam_config.check) { + if (cfg.check) { if (!pkey_check(out, pkey, EVP_PKEY_param_check, "Parameters")) goto end; } - if (!pkeyparam_config.noout) + if (!cfg.noout) PEM_write_bio_Parameters(out, pkey); - if (pkeyparam_config.text) + if (cfg.text) EVP_PKEY_print_params(out, pkey, 0, NULL); ret = 0; -- cgit v1.2.3-55-g6feb