From: Jonathan McDowell Date: Tue, 30 Jul 2019 18:26:58 +0000 (-0300) Subject: Export fingerprint_cmp from keyarray.c X-Git-Tag: onak-0.6.0~51 X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=2039724ebd70536ad567630725f6b75b7868e486;p=onak.git 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. --- 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__ */