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

LCOV - code coverage report
Current view: top level - TSRM - tsrm_strtok_r.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 0 21 0.0 %
Date: 2014-04-16 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include <stdio.h>
       2             : 
       3             : #include "tsrm_config_common.h"
       4             : #include "tsrm_strtok_r.h"
       5             : 
       6           0 : static inline int in_character_class(char ch, const char *delim)
       7             : {
       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           0 : char *tsrm_strtok_r(char *s, const char *delim, char **last)
      18             : {
      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: LCOV version 1.10

Generated at Wed, 16 Apr 2014 12:47:41 +0000 (41 hours ago)

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