Coverage Report

Created: 2023-03-26 07:33

/src/gnutls/lib/minitasn1/version.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) 2000-2022 Free Software Foundation, Inc.
3
 *
4
 * This file is part of LIBTASN1.
5
 *
6
 * The LIBTASN1 library is free software; you can redistribute it
7
 * and/or modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful, but
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
 * 02110-1301, USA
20
 */
21
22
#ifdef HAVE_CONFIG_H
23
# include <config.h>
24
#endif
25
26
#include <string.h>   /* for strverscmp */
27
28
#include "libtasn1.h"
29
30
/**
31
 * asn1_check_version:
32
 * @req_version: Required version number, or %NULL.
33
 *
34
 * Check that the version of the library is at minimum the
35
 * requested one and return the version string; return %NULL if the
36
 * condition is not satisfied.  If a %NULL is passed to this function,
37
 * no check is done, but the version string is simply returned.
38
 *
39
 * See %ASN1_VERSION for a suitable @req_version string.
40
 *
41
 * Returns: Version string of run-time library, or %NULL if the
42
 *   run-time library does not meet the required version number.
43
 */
44
const char *
45
asn1_check_version (const char *req_version)
46
2
{
47
2
  if (!req_version || strverscmp (req_version, ASN1_VERSION) <= 0)
48
2
    return ASN1_VERSION;
49
50
0
  return NULL;
51
2
}