Back to index

php5  5.3.10
Functions
tsrm_strtok_r.c File Reference
#include <stdio.h>
#include "tsrm_config_common.h"
#include "tsrm_strtok_r.h"

Go to the source code of this file.

Functions

static int in_character_class (char ch, const char *delim)
char * tsrm_strtok_r (char *s, const char *delim, char **last)

Function Documentation

static int in_character_class ( char  ch,
const char *  delim 
) [inline, static]

Definition at line 6 of file tsrm_strtok_r.c.

{
       while (*delim) {
              if (*delim == ch) {
                     return 1;
              }
              delim++;
       }
       return 0;
}

Here is the caller graph for this function:

char* tsrm_strtok_r ( char *  s,
const char *  delim,
char **  last 
)

Definition at line 17 of file tsrm_strtok_r.c.

{
       char *token;

       if (s == NULL) {
              s = *last;
       }

       while (*s && in_character_class(*s, delim)) {
              s++;
       }
       if (!*s) {
              return NULL;
       }

       token = s;

       while (*s && !in_character_class(*s, delim)) {
              s++;
       }
       if (!*s) {
              *last = s;
       } else {
              *s = '\0';
              *last = s + 1;
       }
       return token;
}

Here is the call graph for this function: