From 2039724ebd70536ad567630725f6b75b7868e486 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Tue, 30 Jul 2019 15:26:58 -0300 Subject: [PATCH] Export fingerprint_cmp from keyarray.c Comparing fingerprints is generally useful outside of the routines in keyarray.c, so export the function prototype in the header file. --- keyarray.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/keyarray.h b/keyarray.h index 0a137a6..e50a030 100644 --- a/keyarray.h +++ b/keyarray.h @@ -64,4 +64,20 @@ void array_free(struct keyarray *array); */ bool array_add(struct keyarray *array, struct openpgp_fingerprint *fp); +/** + * @brief Compare two OpenPGP fingerprints + * @param a Fingerprint 1 + * @param b Fingerprint 2 + * + * Compares 2 OpenPGP fingerprints, returning an integer less than, equal to, + * or greater than zero depending on whether a is less than, matches, or is + * greater than b. + * + * For the purposes of comparison shorter fingerprints sort earlier than + * longer fingerprints (i.e. v3 < v4 < v5) and comparison of same-length + * fingerprints treats them as a numberical value. + */ +int fingerprint_cmp(struct openpgp_fingerprint *a, + struct openpgp_fingerprint *b); + #endif /* __KEYARRAY_H__ */ -- 2.39.5