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: 2013-07-24 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-2013 Simon Josefsson
       3                 :            : 
       4                 :            :    This program is free software: you can redistribute it and/or modify
       5                 :            :    it under the terms of the GNU General Public License as published by
       6                 :            :    the Free Software Foundation, either version 3 of the License, or
       7                 :            :    (at your option) any later version.
       8                 :            : 
       9                 :            :    This program is distributed in the hope that it will be useful,
      10                 :            :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      11                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12                 :            :    GNU General Public License for more details.
      13                 :            : 
      14                 :            :    You should have received a copy of the GNU General Public License
      15                 :            :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      16                 :            : */
      17                 :            : 
      18                 :            : #include <config.h>
      19                 :            : 
      20                 :            : #include "tables.h"
      21                 :            : 
      22                 :            : #include <stdlib.h>               /* abort */
      23                 :            : 
      24                 :            : #include "data.h"
      25                 :            : 
      26                 :            : static int
      27                 :      10600 : property (uint32_t cp)
      28                 :            : {
      29                 :      10600 :   const struct idna_table *p = idna_table;
      30                 :            : 
      31 [ +  + ][ +  - ]:    4705609 :   while (p->start != 0 || p->end != 0)
      32                 :            :     {
      33 [ +  + ][ +  + ]:    4705609 :       if (p->end == 0 && p->start == cp)
      34                 :        580 :         return p->state;
      35 [ +  - ][ +  + ]:    4705029 :       else if (p->start <= cp && p->end >= cp)
      36                 :      10020 :         return p->state;
      37                 :    4695009 :       p++;
      38                 :            :     }
      39                 :            : 
      40                 :      10600 :   abort ();
      41                 :            : }
      42                 :            : 
      43                 :            : int
      44                 :       2831 : _idn2_disallowed_p (uint32_t cp)
      45                 :            : {
      46                 :       2831 :   return property (cp) == DISALLOWED;
      47                 :            : }
      48                 :            : 
      49                 :            : int
      50                 :       2635 : _idn2_contextj_p (uint32_t cp)
      51                 :            : {
      52                 :       2635 :   return property (cp) == CONTEXTJ;
      53                 :            : }
      54                 :            : 
      55                 :            : int
      56                 :       2590 : _idn2_contexto_p (uint32_t cp)
      57                 :            : {
      58                 :       2590 :   return property (cp) == CONTEXTO;
      59                 :            : }
      60                 :            : 
      61                 :            : int
      62                 :       2544 : _idn2_unassigned_p (uint32_t cp)
      63                 :            : {
      64                 :       2544 :   return property (cp) == UNASSIGNED;
      65                 :            : }

Generated by: LCOV version 1.9