Browse Source

Init char *saveptr=NULL for strtok_r()

Serj Kalichev 10 years ago
parent
commit
4a836e8427

+ 1 - 1
clish/shell/shell_command.c

@@ -125,7 +125,7 @@ void clish_shell_param_generator(clish_shell_t *this, lub_argv_t *matches,
 			/* The 'completion' field of PARAM */
 			if (clish_param__get_completion(param)) {
 				char *str, *q;
-				char *saveptr;
+				char *saveptr = NULL;
 				str = clish_shell_expand(
 					clish_param__get_completion(param), SHELL_VAR_ACTION, &context);
 				if (str) {

+ 1 - 1
clish/shell/shell_plugin.c

@@ -51,7 +51,7 @@ static clish_sym_t *plugins_find_sym(clish_shell_t *this, const char *name, int
 	clish_plugin_t *plugin;
 	clish_sym_t *sym = NULL;
 	/* To parse command name */
-	char *saveptr;
+	char *saveptr = NULL;
 	const char *delim = "@";
 	char *plugin_name = NULL;
 	char *cmdn = NULL;

+ 3 - 2
clish/shell/shell_var.c

@@ -18,7 +18,8 @@ void clish_shell__expand_viewid(const char *viewid, lub_bintree_t *tree,
 	clish_context_t *context)
 {
 	char *expanded;
-	char *q, *saveptr;
+	char *q;
+	char *saveptr = NULL;
 
 	expanded = clish_shell_expand(viewid, SHELL_VAR_NONE, context);
 	if (!expanded)
@@ -240,7 +241,7 @@ static char *expand_nextsegment(const char **string, const char *escape_chars,
 		if (p[-1] == '}') {
 			bool_t valid = BOOL_FALSE;
 			char *text, *q;
-			char *saveptr;
+			char *saveptr = NULL;
 
 			/* get the variable text */
 			text = lub_string_dupn(tmp, len);

+ 2 - 2
clish/shell/shell_xml.c

@@ -90,7 +90,7 @@ int clish_shell_load_scheme(clish_shell_t *this, const char *xml_path)
 	const char *path = xml_path;
 	char *buffer;
 	char *dirname;
-	char *saveptr;
+	char *saveptr = NULL;
 	int res = 0;
 	int i = 0;
 
@@ -485,7 +485,7 @@ static int process_command(clish_shell_t *shell, clish_xmlnode_t *element,
 
 	/* Reference 'ref' field */
 	if (ref) {
-		char *saveptr;
+		char *saveptr = NULL;
 		const char *delim = "@";
 		char *view_name = NULL;
 		char *cmdn = NULL;

+ 1 - 1
lub/ini/ini.c

@@ -99,7 +99,7 @@ const char *lub_ini_find(const lub_ini_t *this, const char *name)
 int lub_ini_parse_str(lub_ini_t *this, const char *ini)
 {
 	char *buffer;
-	char *saveptr;
+	char *saveptr = NULL;
 	char *line;
 
 	buffer = lub_string_dup(ini);

+ 1 - 1
plugins/clish/hook_access.c

@@ -34,7 +34,7 @@ CLISH_HOOK_ACCESS(clish_hook_access)
 	gid_t *group_list;
 	int i;
 	char *tmp_access, *full_access;
-	char *saveptr;
+	char *saveptr = NULL;
 
 	assert(access);
 	full_access = lub_string_dup(access);