[asterisk-commits] bbryant: branch group/data_api_gsoc2009 r205783 - /team/group/data_api_gsoc20...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 10 11:15:02 CDT 2009


Author: bbryant
Date: Fri Jul 10 11:14:59 2009
New Revision: 205783

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205783
Log:
Convert uses of strtok to strtok_r

Modified:
    team/group/data_api_gsoc2009/main/data.c

Modified: team/group/data_api_gsoc2009/main/data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/data.c?view=diff&rev=205783&r1=205782&r2=205783
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Fri Jul 10 11:14:59 2009
@@ -760,7 +760,7 @@
 static struct ast_data_search *data_search_parse(const char *search_string)
 {
 	struct ast_str *name, *value, *comparison;
-	char *elements, *search_string_dup;
+	char *elements, *search_string_dup, *saveptr;
 	int i;
 	struct ast_data_search *root, *child;
 	enum data_search_comparison cmp_type;
@@ -785,7 +785,7 @@
 		return NULL;
 	}
 
-	for (elements = strtok(search_string_dup, ","); elements; elements = strtok(NULL, ",")) {
+	for (elements = strtok_r(search_string_dup, ",", &saveptr); elements; elements = strtok_r(NULL, ",", &saveptr)) {
 		/* Parse the name */
 		ast_str_reset(name);
 		for (i = 0; !data_search_comparison_char(elements[i]) &&
@@ -1108,9 +1108,9 @@
 	int found;
 	struct data_filter_list **list_head = &flist;
 	struct data_filter_node *node;
-	char *token;
-
-	for (token = strtok(path, "/"); token; token = strtok(NULL, "/")) {
+	char *token, *saveptr;
+
+	for (token = strtok_r(path, "/", &saveptr); token; token = strtok_r(NULL, "/", &saveptr)) {
 		if (!flist) {
 			flist = ast_calloc(1, sizeof(*flist));
 			if (!flist) {
@@ -1154,9 +1154,9 @@
 static struct data_filter_list *data_filter_generate(const char *constfilter)
 {
 	struct data_filter_list *filter = NULL;
-	char *strfilter = ast_strdupa(constfilter), *token;
-
-	for (token = strtok(strfilter, ","); token; token = strtok(NULL, ",")) {
+	char *strfilter = ast_strdupa(constfilter), *token, *saveptr;
+
+	for (token = strtok_r(strfilter, ",", &saveptr); token; token = strtok_r(NULL, ",", &saveptr)) {
 		filter = data_filter_add_node(filter, token);
 	}
 
@@ -1172,9 +1172,9 @@
  */
 static inline char *data_filter_get_last_leaf(const char *constpath)
 {
-	char *path = ast_strdupa(constpath), *leaf = NULL, *token;
-
-	for (token = strtok(path, "/"); token; token = strtok(NULL, "/")) {
+	char *path = ast_strdupa(constpath), *leaf = NULL, *token, *saveptr;
+
+	for (token = strtok_r(path, "/", &saveptr); token; token = strtok_r(NULL, "/", &saveptr)) {
 		leaf = token;
 	}
 




More information about the asterisk-commits mailing list