From a5d4a4b32b11814d673241d62624ecec1d577571 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 15 Nov 2018 19:18:53 +0100 Subject: core: New API gpgrt_cmp_version * src/gpg-error.h.in: New API gpgrt_cmp_version. * src/visibility.c (gpgrt_cmp_version): New wrapper. * src/version.c (parse_version_string): Revamped. (do_cmp_version): New. (_gpgrt_cmp_version): New. (_gpg_error_check_version): Re-implemented using the new func. * tests/t-version.c: Include t-common.h. (t_gpgrt_cmp_version): New test. (main): Run new test. Change test for new version number to require a 2 level number. -- We have implementations of very similar functions in all out libs. Thus it makes sense to provide a generic version. This version is actually derived from the ftp-indexer.c we use for the gnupg website (see the gnupg-doc repo). Signed-off-by: Werner Koch --- src/gpgrt-int.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gpgrt-int.h') diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index 34e494c..b5a4dd1 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -742,6 +742,12 @@ void _gpgrt_set_usage_outfnc (int (*fnc)(int, const char *)); void _gpgrt_set_fixed_string_mapper (const char *(*f)(const char*)); +/* + * Various helper functions + */ +int _gpgrt_cmp_version (const char *a, const char *b, int level); + + /* * Internal platform abstraction functions (sysutils.c) -- cgit v1.2.3