Convert exception_from_error_queue() macros into a single function. Besides code maintainability, this makes our fast path shorter for better cache performance.
diff --git a/src/crypto/x509.c b/src/crypto/x509.c
index 119c048..e089d40 100644
--- a/src/crypto/x509.c
+++ b/src/crypto/x509.c
@@ -136,7 +136,7 @@
if (bignum == NULL) {
if (ASN1_INTEGER_set(X509_get_serialNumber(self->x509), small_serial)) {
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
goto err;
}
} else {
@@ -144,11 +144,11 @@
BN_free(bignum);
bignum = NULL;
if (asn1_i == NULL) {
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
goto err;
}
if (!X509_set_serialNumber(self->x509, asn1_i)) {
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
goto err;
}
ASN1_INTEGER_free(asn1_i);
@@ -221,7 +221,7 @@
if (!X509_set_issuer_name(self->x509, issuer->x509_name))
{
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
return NULL;
}
@@ -273,7 +273,7 @@
if (!X509_set_subject_name(self->x509, subject->x509_name))
{
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
return NULL;
}
@@ -299,7 +299,7 @@
if ((pkey = X509_get_pubkey(self->x509)) == NULL)
{
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
return NULL;
}
@@ -327,7 +327,7 @@
if (!X509_set_pubkey(self->x509, pkey->pkey))
{
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
return NULL;
}
@@ -422,7 +422,7 @@
} else {
ASN1_TIME_to_generalizedtime(timestamp, >_timestamp);
if (gt_timestamp == NULL) {
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
return NULL;
} else {
py_timestamp = PyString_FromString((char *)gt_timestamp->data);
@@ -558,7 +558,7 @@
if (!X509_sign(self->x509, pkey->pkey, digest))
{
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
return NULL;
}
@@ -629,7 +629,7 @@
if (!X509_digest(self->x509,digest,fp,&len))
{
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
}
tmp = malloc(3*len+1);
memset(tmp, 0, 3*len+1);
@@ -679,7 +679,7 @@
if (!X509_add_ext(self->x509, ext->x509_extension, -1))
{
Py_DECREF(seq);
- exception_from_error_queue();
+ exception_from_error_queue(crypto_Error);
return NULL;
}
}