LCOV - code coverage report
Current view: top level - home/jas/src/libidn2 - version.c (source / functions) Hit Total Coverage
Test: libidn2 Lines: 4 4 100.0 %
Date: 2014-06-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1                 :            : /* version.c - implementation of version checking functions
       2                 :            :    Copyright (C) 2011-2014 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                 :            : /**
      36                 :            :  * idn2_check_version:
      37                 :            :  * @req_version: version string to compare with, or NULL.
      38                 :            :  *
      39                 :            :  * Check IDN2 library version.  This function can also be used to read
      40                 :            :  * out the version of the library code used.  See %IDN2_VERSION for a
      41                 :            :  * suitable @req_version string, it corresponds to the idn2.h header
      42                 :            :  * file version.  Normally these two version numbers match, but if you
      43                 :            :  * are using an application built against an older libidn2 with a
      44                 :            :  * newer libidn2 shared library they will be different.
      45                 :            :  *
      46                 :            :  * Return value: Check that the version of the library is at
      47                 :            :  *   minimum the one given as a string in @req_version and return the
      48                 :            :  *   actual version string of the library; return NULL if the
      49                 :            :  *   condition is not met.  If NULL is passed to this function no
      50                 :            :  *   check is done and only the version string is returned.
      51                 :            :  **/
      52                 :            : const char *
      53                 :          3 : idn2_check_version (const char *req_version)
      54                 :            : {
      55 [ +  + ][ +  + ]:          3 :   if (!req_version || strverscmp (req_version, IDN2_VERSION) <= 0)
      56                 :          2 :     return IDN2_VERSION;
      57                 :            : 
      58                 :          3 :   return NULL;
      59                 :            : }

Generated by: LCOV version 1.9