PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - gd/libgd - gdhelpers.c
Test: PHP Code Coverage
Date: 2009-11-19 Instrumented lines: 29
Code covered: 55.2 % Executed lines: 16
Legend: not executed executed

       1                 : #ifdef HAVE_CONFIG_H
       2                 : #include "config.h"
       3                 : #endif
       4                 : 
       5                 : #include "gd.h"
       6                 : #include "gdhelpers.h"
       7                 : #include <stdlib.h>
       8                 : #include <string.h>
       9                 : 
      10                 : /* TBB: gd_strtok_r is not portable; provide an implementation */
      11                 : 
      12                 : #define SEP_TEST (separators[*((unsigned char *) s)])
      13                 : 
      14                 : char *
      15                 : gd_strtok_r (char *s, char *sep, char **state)
      16               5 : {
      17                 :   char separators[256];
      18                 :   char *start;
      19               5 :   char *result = 0;
      20               5 :   memset (separators, 0, sizeof (separators));
      21              15 :   while (*sep)
      22                 :     {
      23               5 :       separators[*((unsigned char *) sep)] = 1;
      24               5 :       sep++;
      25                 :     }
      26               5 :   if (!s)
      27                 :     {
      28                 :       /* Pick up where we left off */
      29               0 :       s = *state;
      30                 :     }
      31               5 :   start = s;
      32                 :   /* 1. EOS */
      33               5 :   if (!(*s))
      34                 :     {
      35               0 :       *state = s;
      36               0 :       return 0;
      37                 :     }
      38                 :   /* 2. Leading separators, if any */
      39               5 :   if (SEP_TEST)
      40                 :     {
      41                 :       do
      42                 :         {
      43               0 :           s++;
      44                 :         }
      45               0 :       while (SEP_TEST);
      46                 :       /* 2a. EOS after separators only */
      47               0 :       if (!(*s))
      48                 :         {
      49               0 :           *state = s;
      50               0 :           return 0;
      51                 :         }
      52                 :     }
      53                 :   /* 3. A token */
      54               5 :   result = s;
      55                 :   do
      56                 :     {
      57                 :       /* 3a. Token at end of string */
      58             228 :       if (!(*s))
      59                 :         {
      60               5 :           *state = s;
      61               5 :           return result;
      62                 :         }
      63             223 :       s++;
      64                 :     }
      65             223 :   while (!SEP_TEST);
      66                 :   /* 4. Terminate token and skip trailing separators */
      67               0 :   *s = '\0';
      68                 :   do
      69                 :     {
      70               0 :       s++;
      71                 :     }
      72               0 :   while (SEP_TEST);
      73                 :   /* 5. Return token */
      74               0 :   *state = s;
      75               0 :   return result;
      76                 : }

Generated by: LTP GCOV extension version 1.5

Generated at Thu, 19 Nov 2009 08:20:08 +0000 (5 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.