Skip to content

Commit

Permalink
global: drop unnecessary parens in &(foo)
Browse files Browse the repository at this point in the history
This makes the code more consistent since most of the repo uses the
no-parens style.  These inconsistencies were found using
`git grep '(&([^*]'` and any use of the parens in macros was ignored for
safety reasons.
  • Loading branch information
Josef 'Jeff' Sipek authored and cmouse committed Dec 13, 2017
1 parent 4afd5b6 commit c5e46db
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 76 deletions.
12 changes: 6 additions & 6 deletions src/auth/auth-policy.c
Expand Up @@ -234,10 +234,10 @@ void auth_policy_finish(struct policy_lookup_ctx *context)
{
if (context->parser != NULL) {
const char *error ATTR_UNUSED;
(void)json_parser_deinit(&(context->parser), &error);
(void)json_parser_deinit(&context->parser, &error);
}
if (context->http_request != NULL)
http_client_request_abort(&(context->http_request));
http_client_request_abort(&context->http_request);
if (context->request != NULL)
auth_request_unref(&context->request);
}
Expand All @@ -260,7 +260,7 @@ void auth_policy_parse_response(struct policy_lookup_ctx *context)
else
continue;
} else if (context->parse_state == POLICY_RESULT_VALUE_STATUS) {
if (type != JSON_TYPE_NUMBER || str_to_int(value, &(context->result)) != 0)
if (type != JSON_TYPE_NUMBER || str_to_int(value, &context->result) != 0)
break;
context->parse_state = POLICY_RESULT;
} else if (context->parse_state == POLICY_RESULT_VALUE_MESSAGE) {
Expand All @@ -279,7 +279,7 @@ void auth_policy_parse_response(struct policy_lookup_ctx *context)

context->parse_error = TRUE;

io_remove(&(context->io));
io_remove(&context->io);

if (context->payload->stream_errno != 0) {
auth_request_log_error(context->request, "policy",
Expand All @@ -293,13 +293,13 @@ void auth_policy_parse_response(struct policy_lookup_ctx *context)
"Policy server response was malformed");
} else {
const char *error = "unknown";
if (json_parser_deinit(&(context->parser), &error) != 0)
if (json_parser_deinit(&context->parser, &error) != 0)
auth_request_log_error(context->request, "policy",
"Policy server response JSON parse error: %s", error);
else if (context->parse_state == POLICY_RESULT)
context->parse_error = FALSE;
}
i_stream_unref(&(context->payload));
i_stream_unref(&context->payload);

if (context->parse_error) {
context->result = (context->set->policy_reject_on_fail ? -1 : 0);
Expand Down
6 changes: 3 additions & 3 deletions src/doveadm/doveadm-cmd.c
Expand Up @@ -233,7 +233,7 @@ doveadm_cmd_param_get(const struct doveadm_cmd_context *cctx,
i_assert(cctx->argv != NULL);
for(int i = 0; i < cctx->argc; i++) {
if (strcmp(cctx->argv[i].name, name) == 0 && cctx->argv[i].value_set)
return &(cctx->argv[i]);
return &cctx->argv[i];
}
return NULL;
}
Expand Down Expand Up @@ -327,7 +327,7 @@ void doveadm_cmd_params_clean(ARRAY_TYPE(doveadm_cmd_param_arr_t) *pargv)
array_foreach_modifiable(pargv, param) {
if (param->type == CMD_PARAM_ISTREAM &&
param->value.v_istream != NULL)
i_stream_destroy(&(param->value.v_istream));
i_stream_destroy(&param->value.v_istream);
}
array_clear(pargv);
}
Expand Down Expand Up @@ -516,7 +516,7 @@ int doveadm_cmd_run_ver2(int argc, const char *const argv[],

for(pargc=0;cctx->cmd->parameters[pargc].name != NULL;pargc++) {
param = array_append_space(&pargv);
memcpy(param, &(cctx->cmd->parameters[pargc]), sizeof(struct doveadm_cmd_param));
memcpy(param, &cctx->cmd->parameters[pargc], sizeof(struct doveadm_cmd_param));
param->value_set = FALSE;
}
i_assert(pargc == array_count(&opts)-1); /* opts is NULL-terminated */
Expand Down
10 changes: 5 additions & 5 deletions src/lib-dcrypt/dcrypt-gnutls.c
Expand Up @@ -147,7 +147,7 @@ static
int dcrypt_gnutls_ctx_sym_init(struct dcrypt_context_symmetric *ctx, const char **error_r)
{
int ec;
ec = gnutls_cipher_init(&(ctx->ctx), ctx->cipher, &ctx->key, &ctx->iv);
ec = gnutls_cipher_init(&ctx->ctx, ctx->cipher, &ctx->key, &ctx->iv);
if(ec < 0) return dcrypt_gnutls_error(ec, error_r);
return 0;
}
Expand Down Expand Up @@ -216,7 +216,7 @@ static
int dcrypt_gnutls_ctx_hmac_init(struct dcrypt_context_hmac *ctx, const char **error_r)
{
int ec;
ec = gnutls_hmac_init(&(ctx->ctx), ctx->md, ctx->key.data, ctx->key.size);
ec = gnutls_hmac_init(&ctx->ctx, ctx->md, ctx->key.data, ctx->key.size);
if (ec < 0) return dcrypt_gnutls_error(ec, error_r);
return 0;
}
Expand Down Expand Up @@ -307,7 +307,7 @@ int dcrypt_gnutls_generate_keypair(struct dcrypt_keypair *pair_r, enum dcrypt_ke

pair_r->priv = (struct dcrypt_private_key*)priv;

return dcrypt_gnutls_private_to_public_key(pair_r->priv, &(pair_r->pub), error_r);
return dcrypt_gnutls_private_to_public_key(pair_r->priv, &pair_r->pub, error_r);
}

static
Expand Down Expand Up @@ -407,8 +407,8 @@ void dcrypt_gnutls_free_private_key(struct dcrypt_private_key **key)
static
void dcrypt_gnutls_free_keypair(struct dcrypt_keypair *keypair)
{
dcrypt_gnutls_free_public_key(&(keypair->pub));
dcrypt_gnutls_free_private_key(&(keypair->priv));
dcrypt_gnutls_free_public_key(&keypair->pub);
dcrypt_gnutls_free_private_key(&keypair->priv);
}

static
Expand Down
8 changes: 4 additions & 4 deletions src/lib-dcrypt/dcrypt-openssl.c
Expand Up @@ -743,7 +743,7 @@ bool dcrypt_openssl_generate_keypair(struct dcrypt_keypair *pair_r, enum dcrypt_
pair_r->priv->key = pkey;
pair_r->priv->ref++;
pair_r->pub = NULL;
dcrypt_openssl_private_to_public_key(pair_r->priv, &(pair_r->pub));
dcrypt_openssl_private_to_public_key(pair_r->priv, &pair_r->pub);
return TRUE;
} else return dcrypt_openssl_error(error_r);
} else if (kind == DCRYPT_KEY_EC) {
Expand All @@ -758,7 +758,7 @@ bool dcrypt_openssl_generate_keypair(struct dcrypt_keypair *pair_r, enum dcrypt_
pair_r->priv->key = pkey;
pair_r->priv->ref++;
pair_r->pub = NULL;
dcrypt_openssl_private_to_public_key(pair_r->priv, &(pair_r->pub));
dcrypt_openssl_private_to_public_key(pair_r->priv, &pair_r->pub);
return TRUE;
} else return dcrypt_openssl_error(error_r);
}
Expand Down Expand Up @@ -1983,8 +1983,8 @@ static
void dcrypt_openssl_unref_keypair(struct dcrypt_keypair *keypair)
{
i_assert(keypair != NULL);
dcrypt_openssl_unref_public_key(&(keypair->pub));
dcrypt_openssl_unref_private_key(&(keypair->priv));
dcrypt_openssl_unref_public_key(&keypair->pub);
dcrypt_openssl_unref_private_key(&keypair->priv);
}

static
Expand Down
18 changes: 9 additions & 9 deletions src/lib-dcrypt/istream-decrypt.c
Expand Up @@ -129,7 +129,7 @@ ssize_t i_stream_decrypt_read_header_v1(struct decrypt_istream *stream,
/* see if we can get one */
if (stream->key_callback != NULL) {
const char *key_id = binary_to_hex(digest_pos, digest_len);
int ret = stream->key_callback(key_id, &(stream->priv_key), &error, stream->key_context);
int ret = stream->key_callback(key_id, &stream->priv_key, &error, stream->key_context);
if (ret < 0) {
io_stream_set_error(&stream->istream.iostream, "Private key not available: %s", error);
return -1;
Expand Down Expand Up @@ -213,7 +213,7 @@ ssize_t i_stream_decrypt_read_header_v1(struct decrypt_istream *stream,
}

/* prime context with key */
if (!dcrypt_ctx_sym_create("aes-256-ctr", DCRYPT_MODE_DECRYPT, &(stream->ctx_sym), &error)) {
if (!dcrypt_ctx_sym_create("aes-256-ctr", DCRYPT_MODE_DECRYPT, &stream->ctx_sym, &error)) {
io_stream_set_error(&stream->istream.iostream, "Decryption context create error: %s", error);
return -1;
}
Expand Down Expand Up @@ -313,7 +313,7 @@ ssize_t i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg, u
if (stream->key_callback != NULL) {
const char *hexdgst = binary_to_hex(data, sizeof(dgst)); /* digest length */
/* hope you going to give us right key.. */
int ret = stream->key_callback(hexdgst, &(stream->priv_key), &error, stream->key_context);
int ret = stream->key_callback(hexdgst, &stream->priv_key, &error, stream->key_context);
if (ret < 0) {
io_stream_set_error(&stream->istream.iostream, "Private key not available: %s", error);
return -1;
Expand Down Expand Up @@ -477,7 +477,7 @@ int i_stream_decrypt_header_contents(struct decrypt_istream *stream,
const char *calg;
if (!i_stream_decrypt_der(&data, end, &calg))
return 0;
if (calg == NULL || !dcrypt_ctx_sym_create(calg, DCRYPT_MODE_DECRYPT, &(stream->ctx_sym), NULL)) {
if (calg == NULL || !dcrypt_ctx_sym_create(calg, DCRYPT_MODE_DECRYPT, &stream->ctx_sym, NULL)) {
io_stream_set_error(&stream->istream.iostream, "Decryption error: unsupported/invalid cipher: %s", calg);
return -1;
}
Expand All @@ -486,7 +486,7 @@ int i_stream_decrypt_header_contents(struct decrypt_istream *stream,
const char *malg;
if (!i_stream_decrypt_der(&data, end, &malg))
return 0;
if (malg == NULL || !dcrypt_ctx_hmac_create(malg, &(stream->ctx_mac), NULL)) {
if (malg == NULL || !dcrypt_ctx_hmac_create(malg, &stream->ctx_mac, NULL)) {
io_stream_set_error(&stream->istream.iostream, "Decryption error: unsupported/invalid MAC algorithm: %s", malg);
return -1;
}
Expand Down Expand Up @@ -840,13 +840,13 @@ void i_stream_decrypt_destroy(struct iostream_private *stream)
if (dstream->iv != NULL)
i_free_and_null(dstream->iv);
if (dstream->ctx_sym != NULL)
dcrypt_ctx_sym_destroy(&(dstream->ctx_sym));
dcrypt_ctx_sym_destroy(&dstream->ctx_sym);
if (dstream->ctx_mac != NULL)
dcrypt_ctx_hmac_destroy(&(dstream->ctx_mac));
dcrypt_ctx_hmac_destroy(&dstream->ctx_mac);
if (dstream->priv_key != NULL)
dcrypt_key_unref_private(&(dstream->priv_key));
dcrypt_key_unref_private(&dstream->priv_key);

i_stream_unref(&(dstream->istream.parent));
i_stream_unref(&dstream->istream.parent);
}

static
Expand Down
16 changes: 8 additions & 8 deletions src/lib-dcrypt/ostream-encrypt.c
Expand Up @@ -568,12 +568,12 @@ void o_stream_encrypt_destroy(struct iostream_private *stream)
{
struct encrypt_ostream *estream = (struct encrypt_ostream *)stream;
/* release resources */
if (estream->ctx_sym != NULL) dcrypt_ctx_sym_destroy(&(estream->ctx_sym));
if (estream->ctx_mac != NULL) dcrypt_ctx_hmac_destroy(&(estream->ctx_mac));
if (estream->ctx_sym != NULL) dcrypt_ctx_sym_destroy(&estream->ctx_sym);
if (estream->ctx_mac != NULL) dcrypt_ctx_hmac_destroy(&estream->ctx_mac);
if (estream->key_data != NULL) i_free(estream->key_data);
if (estream->cipher_oid != NULL) buffer_free(&(estream->cipher_oid));
if (estream->mac_oid != NULL) buffer_free(&(estream->mac_oid));
if (estream->pub != NULL) dcrypt_key_unref_public(&(estream->pub));
if (estream->cipher_oid != NULL) buffer_free(&estream->cipher_oid);
if (estream->mac_oid != NULL) buffer_free(&estream->mac_oid);
if (estream->pub != NULL) dcrypt_key_unref_public(&estream->pub);
o_stream_unref(&estream->ostream.parent);
}

Expand All @@ -584,7 +584,7 @@ int o_stream_encrypt_init(struct encrypt_ostream *estream, const char *algorithm
char *calg, *malg;

if ((estream->flags & IO_STREAM_ENC_VERSION_1) == IO_STREAM_ENC_VERSION_1) {
if (!dcrypt_ctx_sym_create("AES-256-CTR", DCRYPT_MODE_ENCRYPT, &(estream->ctx_sym), &error)) {
if (!dcrypt_ctx_sym_create("AES-256-CTR", DCRYPT_MODE_ENCRYPT, &estream->ctx_sym, &error)) {
io_stream_set_error(&estream->ostream.iostream, "Cannot create ostream-encrypt: %s", error);
return -1;
}
Expand All @@ -601,7 +601,7 @@ int o_stream_encrypt_init(struct encrypt_ostream *estream, const char *algorithm
}
(*malg++) = '\0';

if (!dcrypt_ctx_sym_create(calg, DCRYPT_MODE_ENCRYPT, &(estream->ctx_sym), &error)) {
if (!dcrypt_ctx_sym_create(calg, DCRYPT_MODE_ENCRYPT, &estream->ctx_sym, &error)) {
io_stream_set_error(&estream->ostream.iostream, "Cannot create ostream-encrypt: %s", error);
return -1;
}
Expand All @@ -616,7 +616,7 @@ int o_stream_encrypt_init(struct encrypt_ostream *estream, const char *algorithm

/* mac context is optional */
if ((estream->flags & IO_STREAM_ENC_INTEGRITY_HMAC) == IO_STREAM_ENC_INTEGRITY_HMAC) {
if (!dcrypt_ctx_hmac_create(malg, &(estream->ctx_mac), &error)) {
if (!dcrypt_ctx_hmac_create(malg, &estream->ctx_mac, &error)) {
io_stream_set_error(&estream->ostream.iostream, "Cannot create ostream-encrypt: %s", error);
return -1;
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib-dict-backend/dict-ldap.c
Expand Up @@ -210,10 +210,10 @@ ldap_dict_build_query(struct ldap_dict *dict, const struct dict_ldap_map *map,
template = map->filter;
}

for(size_t i = 0; i < array_count(values) && i < array_count(&(map->ldap_attributes)); i++) {
for(size_t i = 0; i < array_count(values) && i < array_count(&map->ldap_attributes); i++) {
struct var_expand_table entry;
const char *const *valuep = array_idx(values, i);
const char *const *long_keyp = array_idx(&(map->ldap_attributes), i);
const char *const *long_keyp = array_idx(&map->ldap_attributes, i);

entry.value = ldap_escape(*valuep);
entry.long_key = *long_keyp;
Expand Down Expand Up @@ -342,7 +342,7 @@ ldap_dict_lookup_callback(struct ldap_result *result, struct dict_ldap_op *op)
}
ldap_search_iterator_deinit(&iter);
}
op->callback(&(op->res), op->callback_ctx);
op->callback(&op->res, op->callback_ctx);
pool_unref(&pool);
}

Expand Down Expand Up @@ -441,7 +441,7 @@ void ldap_dict_lookup_async(struct dict *dict, const char *key,
input.scope = map->scope_val;
if (!ldap_dict_build_query(ctx, map, &values, strncmp(key, DICT_PATH_PRIVATE, strlen(DICT_PATH_PRIVATE))==0, query, &error)) {
op->res.error = error;
callback(&(op->res), context);
callback(&op->res, context);
pool_unref(&oppool);
}
input.filter = str_c(query);
Expand All @@ -451,7 +451,7 @@ void ldap_dict_lookup_async(struct dict *dict, const char *key,
ldap_search_start(ctx->client, &input, ldap_dict_lookup_callback, op);
} else {
op->res.error = "no such key";
callback(&(op->res), context);
callback(&op->res, context);
pool_unref(&oppool);
}
}
Expand Down

0 comments on commit c5e46db

Please sign in to comment.