summaryrefslogtreecommitdiff
path: root/src/sp_config_utils.c
blob: 415e4343fdf74457971b19fc9ce7e6a56cf93339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "php_snuffleupagus.h"


sp_list_node *parse_functions_list(const char *const value) {
  static const char *const sep = ">";

  if (NULL == strchr(value, sep[0])) {
    return NULL;
  }

  sp_list_node *list = NULL;
  char *tmp = strdup(value);
  const char *function_name;
  char *next_token = NULL;
  for (function_name = strtok_r(tmp, sep, &next_token); function_name;
       function_name = strtok_r(NULL, sep, &next_token)) {
    list = sp_list_prepend(list, strdup(function_name));
  }
  free(tmp);

  return list;
}