LCOV - code coverage report
Current view: top level - builds/libidn/libidn2/lib - version.c (source / functions) Hit Total Coverage
Test: Libidn2-2.3.7.3-61ee Code Coverage Lines: 4 4 100.0 %
Date: 2024-12-01 07:08:19 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* version.c - implementation of version checking functions
       2             :    Copyright (C) 2011-2024 Simon Josefsson
       3             : 
       4             :    Libidn2 is free software: you can redistribute it and/or modify it
       5             :    under the terms of either:
       6             : 
       7             :      * the GNU Lesser General Public License as published by the Free
       8             :        Software Foundation; either version 3 of the License, or (at
       9             :        your option) any later version.
      10             : 
      11             :    or
      12             : 
      13             :      * the GNU General Public License as published by the Free
      14             :        Software Foundation; either version 2 of the License, or (at
      15             :        your option) any later version.
      16             : 
      17             :    or both in parallel, as here.
      18             : 
      19             :    This program is distributed in the hope that it will be useful,
      20             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      21             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      22             :    GNU General Public License for more details.
      23             : 
      24             :    You should have received copies of the GNU General Public License and
      25             :    the GNU Lesser General Public License along with this program.  If
      26             :    not, see <http://www.gnu.org/licenses/>.
      27             : */
      28             : 
      29             : #include <config.h>
      30             : 
      31             : #include "idn2.h"
      32             : 
      33             : #include <string.h>               /* strverscmp */
      34             : 
      35             : #ifdef __cplusplus
      36             : extern                          // define a global const variable in C++, C doesn't need it.
      37             : #endif
      38             : const char version_etc_copyright[] =
      39             :   /* Do *not* mark this string for translation */
      40             :   "Copyright (C) 2011-2024  Simon Josefsson";
      41             : 
      42             : /**
      43             :  * idn2_check_version:
      44             :  * @req_version: version string to compare with, or NULL.
      45             :  *
      46             :  * Check IDN2 library version.  This function can also be used to read
      47             :  * out the version of the library code used.  See %IDN2_VERSION for a
      48             :  * suitable @req_version string, it corresponds to the idn2.h header
      49             :  * file version.  Normally these two version numbers match, but if you
      50             :  * are using an application built against an older libidn2 with a
      51             :  * newer libidn2 shared library they will be different.
      52             :  *
      53             :  * Return value: Check that the version of the library is at
      54             :  *   minimum the one given as a string in @req_version and return the
      55             :  *   actual version string of the library; return NULL if the
      56             :  *   condition is not met.  If NULL is passed to this function no
      57             :  *   check is done and only the version string is returned.
      58             :  **/
      59             : const char *
      60          59 : idn2_check_version (const char *req_version)
      61             : {
      62          59 :   if (!req_version || strverscmp (req_version, IDN2_VERSION) <= 0)
      63          21 :     return IDN2_VERSION;
      64             : 
      65          38 :   return NULL;
      66             : }

Generated by: LCOV version 1.16