make code cleaner than it was I when I started :)

This commit is contained in:
Jeremy Johnstone 2017-09-11 10:46:01 -06:00
parent e7cd93ba73
commit 2971456019

13
gnupg.c
View file

@ -1501,12 +1501,13 @@ PHP_FUNCTION(gnupg_messagekeys)
if (!PHP_GNUPG_DO(gpgme_data_new_from_mem(&in, enctxt, enctxt_len, 0))) { if (!PHP_GNUPG_DO(gpgme_data_new_from_mem(&in, enctxt, enctxt_len, 0))) {
GNUPG_ERR("could not create in-data buffer"); GNUPG_ERR("could not create in-data buffer");
RETURN_FALSE;
} }
if ((PHPC_THIS->err = gpgme_data_new(&out)) != GPG_ERR_NO_ERROR) { if ((PHPC_THIS->err = gpgme_data_new(&out)) != GPG_ERR_NO_ERROR) {
GNUPG_ERR("could not create out-data buffer"); GNUPG_ERR("could not create out-data buffer");
gpgme_data_release(in); gpgme_data_release(in);
return; RETURN_FALSE;
} }
PHP_GNUPG_DO(gpgme_op_decrypt(PHPC_THIS->ctx, in, out)); PHP_GNUPG_DO(gpgme_op_decrypt(PHPC_THIS->ctx, in, out));
@ -1516,7 +1517,11 @@ PHP_FUNCTION(gnupg_messagekeys)
gpgme_data_release(in); gpgme_data_release(in);
gpgme_data_release(out); gpgme_data_release(out);
if (result->recipients) { if (!result->recipients) {
GNUPG_ERR("invalid enctext");
RETURN_FALSE;
}
PHPC_ARRAY_INIT(return_value); PHPC_ARRAY_INIT(return_value);
recipient = result->recipients; recipient = result->recipients;
@ -1526,10 +1531,6 @@ PHP_FUNCTION(gnupg_messagekeys)
recipient = recipient->next; recipient = recipient->next;
} }
} else {
GNUPG_ERR("invalid enctext");
RETVAL_FALSE;
}
} }
/* }}} */ /* }}} */