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

           Branch data     Line data    Source code
       1                 :            : /* tables.c - IDNA table 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 "tables.h"
      32                 :            : 
      33                 :            : #include <stdlib.h>               /* abort */
      34                 :            : 
      35                 :            : #include "data.h"
      36                 :            : 
      37                 :            : static int
      38                 :      10600 : property (uint32_t cp)
      39                 :            : {
      40                 :      10600 :   const struct idna_table *p = idna_table;
      41                 :            : 
      42 [ +  + ][ +  - ]:    4705609 :   while (p->start != 0 || p->end != 0)
      43                 :            :     {
      44 [ +  + ][ +  + ]:    4705609 :       if (p->end == 0 && p->start == cp)
      45                 :        580 :         return p->state;
      46 [ +  - ][ +  + ]:    4705029 :       else if (p->start <= cp && p->end >= cp)
      47                 :      10020 :         return p->state;
      48                 :    4695009 :       p++;
      49                 :            :     }
      50                 :            : 
      51                 :      10600 :   abort ();
      52                 :            : }
      53                 :            : 
      54                 :            : int
      55                 :       2831 : _idn2_disallowed_p (uint32_t cp)
      56                 :            : {
      57                 :       2831 :   return property (cp) == DISALLOWED;
      58                 :            : }
      59                 :            : 
      60                 :            : int
      61                 :       2635 : _idn2_contextj_p (uint32_t cp)
      62                 :            : {
      63                 :       2635 :   return property (cp) == CONTEXTJ;
      64                 :            : }
      65                 :            : 
      66                 :            : int
      67                 :       2590 : _idn2_contexto_p (uint32_t cp)
      68                 :            : {
      69                 :       2590 :   return property (cp) == CONTEXTO;
      70                 :            : }
      71                 :            : 
      72                 :            : int
      73                 :       2544 : _idn2_unassigned_p (uint32_t cp)
      74                 :            : {
      75                 :       2544 :   return property (cp) == UNASSIGNED;
      76                 :            : }

Generated by: LCOV version 1.9