Skip to content

Commit f53c4e9

Browse files
committed
Remove unecessary void castings
1 parent d0aba38 commit f53c4e9

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

common/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ bool read_public_key(uint8_t *buf, size_t len, yh_algorithm *algo,
440440
return false;
441441
}
442442

443-
(void) i2o_ECPublicKey(ec, &bytes);
443+
i2o_ECPublicKey(ec, &bytes);
444444
EC_KEY_free(ec);
445445

446446
*bytes_len = data_len;

examples/ssh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ int main(void) {
280280
bio = BIO_push(b64, bio);
281281

282282
fprintf(stdout, "ssh-rsa-cert-v01@openssh.com ");
283-
(void) BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
283+
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
284284
assert(BIO_write(bio, ssh_req + 4 + 256,
285285
ssh_req_len + ssh_cert_len - 4 - 256) > 0);
286286
assert(BIO_flush(bio) == 1);

lib/yubihsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4666,7 +4666,7 @@ yh_rc yh_init(void) {
46664666
static yh_rc load_backend(const char *name,
46674667
void **backend,
46684668
struct backend_functions **bf) {
4669-
(void)backend;
4669+
UNUSED(backend);
46704670
if (name == NULL) {
46714671
DBG_ERR("No name given to load_backend");
46724672
return YHR_GENERIC_ERROR;

lib/yubihsm_usb.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "yubihsm_usb.h"
2929
#include "debug_lib.h"
3030

31+
#define UNUSED(x) (void) (x)
32+
3133
#ifndef STATIC
3234
uint8_t YH_INTERNAL _yh_verbosity;
3335
FILE YH_INTERNAL *_yh_output;
@@ -51,7 +53,7 @@ static yh_rc backend_connect(yh_connector *connector, int timeout) {
5153
yh_rc ret = YHR_CONNECTOR_ERROR;
5254
yh_backend *backend = NULL;
5355

54-
(void) timeout;
56+
UNUSED(timeout);
5557

5658
if (parse_usb_url(connector->api_url, &serial) == false) {
5759
DBG_ERR("Failed to parse URL: '%s'", connector->api_url);
@@ -82,7 +84,7 @@ static yh_rc backend_send_msg(yh_backend *connection, Msg *msg, Msg *response,
8284
yh_rc ret = YHR_GENERIC_ERROR;
8385
unsigned long read_len = 0;
8486

85-
(void) identifier;
87+
UNUSED(identifier);
8688

8789
for (int i = 0; i <= 1; i++) {
8890
if (ret != YHR_GENERIC_ERROR) {
@@ -131,9 +133,9 @@ static void backend_cleanup(void) { DBG_INFO("backend_cleanup"); }
131133

132134
static yh_rc backend_option(yh_backend *connection, yh_connector_option opt,
133135
const void *val) {
134-
(void) connection;
135-
(void) opt;
136-
(void) val;
136+
UNUSED(connection);
137+
UNUSED(opt);
138+
UNUSED(val);
137139

138140
DBG_ERR("Backend options not (yet?) supported for USB");
139141
return YHR_CONNECTOR_ERROR;

lib/yubihsm_winhttp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ static yh_rc backend_send_msg(yh_backend *backend, Msg *msg, Msg *response,
297297

298298
static yh_rc backend_option(yh_backend *connection, yh_connector_option opt,
299299
const void *val) {
300-
(void) connection;
301-
(void) opt;
302-
(void) val;
300+
UNUSED(connection);
301+
UNUSED(opt);
302+
UNUSED(val);
303303

304304
DBG_ERR("Backend options not (yet?) supported with winhttp");
305305
return YHR_CONNECTOR_ERROR;

pkcs11/util_pkcs11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3813,7 +3813,7 @@ void verify_mechanism_cleanup(yubihsm_pkcs11_op_info *op_info) {
38133813

38143814
void decrypt_mechanism_cleanup(yubihsm_pkcs11_op_info *op_info) {
38153815

3816-
(void) op_info;
3816+
UNUSED(op_info);
38173817
}
38183818

38193819
void digest_mechanism_cleanup(yubihsm_pkcs11_op_info *op_info) {

src/commands.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ int yh_com_connect(yubihsm_context *ctx, Argument *argv, cmd_format in_fmt,
273273
}
274274
yrc = yh_connect(ctx->connector, 0);
275275
if (yrc == YHR_SUCCESS) {
276-
(void) yh_com_keepalive_on(NULL, NULL, fmt_nofmt, fmt_nofmt);
276+
yh_com_keepalive_on(NULL, NULL, fmt_nofmt, fmt_nofmt);
277277
return 0;
278278
}
279279
fprintf(stderr, "Failed connecting '%s': %s\n", ctx->connector_list[i],
@@ -1164,15 +1164,15 @@ int yh_com_get_pubkey(yubihsm_context *ctx, Argument *argv, cmd_format in_fmt,
11641164

11651165
bio = BIO_push(b64, bio);
11661166

1167-
(void) i2d_PUBKEY_bio(bio, public_key);
1167+
i2d_PUBKEY_bio(bio, public_key);
11681168

11691169
if (BIO_flush(bio) != 1) {
11701170
fprintf(stderr, "Unable to flush BIO\n");
11711171
error = true;
11721172
goto getpk_base64_cleanup;
11731173
}
11741174
getpk_base64_cleanup:
1175-
(void) BIO_free_all(b64);
1175+
BIO_free_all(b64);
11761176
if (error) {
11771177
EVP_PKEY_free(public_key);
11781178
return -1;
@@ -1261,15 +1261,15 @@ int yh_com_get_device_pubkey(yubihsm_context *ctx, Argument *argv,
12611261

12621262
bio = BIO_push(b64, bio);
12631263

1264-
(void) i2d_PUBKEY_bio(bio, public_key);
1264+
i2d_PUBKEY_bio(bio, public_key);
12651265

12661266
if (BIO_flush(bio) != 1) {
12671267
fprintf(stderr, "Unable to flush BIO\n");
12681268
BIO_free_all(b64);
12691269
error = true;
12701270
goto getdpk_base64_cleanup;
12711271
}
1272-
(void) BIO_free_all(bio);
1272+
BIO_free_all(bio);
12731273
getdpk_base64_cleanup:
12741274
if (error) {
12751275
EVP_PKEY_free(public_key);
@@ -3190,7 +3190,7 @@ int yh_com_sign_ssh_certificate(yubihsm_context *ctx, Argument *argv,
31903190
}
31913191

31923192
clean_bio:
3193-
(void) BIO_free_all(bio);
3193+
BIO_free_all(bio);
31943194

31953195
return ret;
31963196
}

0 commit comments

Comments
 (0)