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 - var/php_gcov/PHP_5_3/TSRM - tsrm_strtok_r.c
Test: PHP Code Coverage
Date: 2009-11-21 Instrumented lines: 21
Code covered: 0.0 % Executed lines: 0
Legend: not executed executed

       1                 : #include <stdio.h>
       2                 : 
       3                 : #include "tsrm_config_common.h"
       4                 : #include "tsrm_strtok_r.h"
       5                 : 
       6                 : static inline int in_character_class(char ch, const char *delim)
       7               0 : {
       8               0 :         while (*delim) {
       9               0 :                 if (*delim == ch) {
      10               0 :                         return 1;
      11                 :                 }
      12               0 :                 delim++;
      13                 :         }
      14               0 :         return 0;
      15                 : }
      16                 : 
      17                 : char *tsrm_strtok_r(char *s, const char *delim, char **last)
      18               0 : {
      19                 :         char *token;
      20                 : 
      21               0 :         if (s == NULL) {
      22               0 :                 s = *last;
      23                 :         }
      24                 : 
      25               0 :         while (*s && in_character_class(*s, delim)) {
      26               0 :                 s++;
      27                 :         }
      28               0 :         if (!*s) {
      29               0 :                 return NULL;
      30                 :         }
      31                 : 
      32               0 :         token = s;
      33                 : 
      34               0 :         while (*s && !in_character_class(*s, delim)) {
      35               0 :                 s++;
      36                 :         }
      37               0 :         if (!*s) {
      38               0 :                 *last = s;
      39                 :         } else {
      40               0 :                 *s = '\0';
      41               0 :                 *last = s + 1;
      42                 :         }
      43               0 :         return token;
      44                 : }
      45                 : 
      46                 : #if 0
      47                 : 
      48                 : main()
      49                 : {
      50                 :         char foo[] = "/foo/bar//\\barbara";
      51                 :         char *last;
      52                 :         char *token;
      53                 : 
      54                 :         token = tsrm_strtok_r(foo, "/\\", &last);
      55                 :         while (token) {
      56                 :                 printf ("Token = '%s'\n", token);
      57                 :                 token = tsrm_strtok_r(NULL, "/\\", &last);
      58                 :         }
      59                 :         
      60                 :         return 0;
      61                 : }
      62                 : 
      63                 : #endif

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:26:53 +0000 (3 days ago)

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