summaryrefslogtreecommitdiff
path: root/libdane/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdane/errors.c')
-rw-r--r--libdane/errors.c98
1 files changed, 47 insertions, 51 deletions
diff --git a/libdane/errors.c b/libdane/errors.c
index 2e345ad20f..84be88499e 100644
--- a/libdane/errors.c
+++ b/libdane/errors.c
@@ -31,45 +31,44 @@
#define ERROR_ENTRY(desc, name) \
{ desc, #name, name}
-struct error_entry
-{
- const char *desc;
- const char *_name;
- int number;
+struct error_entry {
+ const char *desc;
+ const char *_name;
+ int number;
};
typedef struct error_entry error_entry;
static const error_entry error_algorithms[] = {
- ERROR_ENTRY (N_("Success."), DANE_E_SUCCESS),
- ERROR_ENTRY (N_("There was error initializing the DNS query."),
- DANE_E_INITIALIZATION_ERROR),
- ERROR_ENTRY (N_("There was an error while resolving."),
- DANE_E_RESOLVING_ERROR),
- ERROR_ENTRY (N_("No DANE data were found."),
- DANE_E_NO_DANE_DATA),
- ERROR_ENTRY (N_("Unknown DANE data were found."),
- DANE_E_UNKNOWN_DANE_DATA),
- ERROR_ENTRY (N_("No DNSSEC signature was found."),
- DANE_E_NO_DNSSEC_SIG),
- ERROR_ENTRY (N_("Received corrupt data."),
- DANE_E_RECEIVED_CORRUPT_DATA),
- ERROR_ENTRY (N_("The DNSSEC signature is invalid."),
- DANE_E_INVALID_DNSSEC_SIG),
- ERROR_ENTRY (N_("There was a memory error."),
- DANE_E_MEMORY_ERROR),
- ERROR_ENTRY (N_("There requested data are not available."),
- DANE_E_REQUESTED_DATA_NOT_AVAILABLE),
- ERROR_ENTRY (N_("There request is invalid."),
- DANE_E_INVALID_REQUEST),
- ERROR_ENTRY (N_("There was an error in the certificate."),
- DANE_E_CERT_ERROR),
- ERROR_ENTRY (N_("There was an error in the public key."),
- DANE_E_PUBKEY_ERROR),
- ERROR_ENTRY (N_("No certificate was found."),
- DANE_E_NO_CERT),
- ERROR_ENTRY (N_("Error in file."),
- DANE_E_FILE_ERROR),
- {NULL, NULL, 0}
+ ERROR_ENTRY(N_("Success."), DANE_E_SUCCESS),
+ ERROR_ENTRY(N_("There was error initializing the DNS query."),
+ DANE_E_INITIALIZATION_ERROR),
+ ERROR_ENTRY(N_("There was an error while resolving."),
+ DANE_E_RESOLVING_ERROR),
+ ERROR_ENTRY(N_("No DANE data were found."),
+ DANE_E_NO_DANE_DATA),
+ ERROR_ENTRY(N_("Unknown DANE data were found."),
+ DANE_E_UNKNOWN_DANE_DATA),
+ ERROR_ENTRY(N_("No DNSSEC signature was found."),
+ DANE_E_NO_DNSSEC_SIG),
+ ERROR_ENTRY(N_("Received corrupt data."),
+ DANE_E_RECEIVED_CORRUPT_DATA),
+ ERROR_ENTRY(N_("The DNSSEC signature is invalid."),
+ DANE_E_INVALID_DNSSEC_SIG),
+ ERROR_ENTRY(N_("There was a memory error."),
+ DANE_E_MEMORY_ERROR),
+ ERROR_ENTRY(N_("There requested data are not available."),
+ DANE_E_REQUESTED_DATA_NOT_AVAILABLE),
+ ERROR_ENTRY(N_("There request is invalid."),
+ DANE_E_INVALID_REQUEST),
+ ERROR_ENTRY(N_("There was an error in the certificate."),
+ DANE_E_CERT_ERROR),
+ ERROR_ENTRY(N_("There was an error in the public key."),
+ DANE_E_PUBKEY_ERROR),
+ ERROR_ENTRY(N_("No certificate was found."),
+ DANE_E_NO_CERT),
+ ERROR_ENTRY(N_("Error in file."),
+ DANE_E_FILE_ERROR),
+ {NULL, NULL, 0}
};
/**
@@ -84,24 +83,21 @@ static const error_entry error_algorithms[] = {
*
* Returns: A string explaining the DANE error message.
**/
-const char *
-dane_strerror (int error)
+const char *dane_strerror(int error)
{
- const char *ret = NULL;
- const error_entry *p;
+ const char *ret = NULL;
+ const error_entry *p;
- for (p = error_algorithms; p->desc != NULL; p++)
- {
- if (p->number == error)
- {
- ret = p->desc;
- break;
- }
- }
+ for (p = error_algorithms; p->desc != NULL; p++) {
+ if (p->number == error) {
+ ret = p->desc;
+ break;
+ }
+ }
- /* avoid prefix */
- if (ret == NULL)
- return _("(unknown error code)");
+ /* avoid prefix */
+ if (ret == NULL)
+ return _("(unknown error code)");
- return _(ret);
+ return _(ret);
}