Commit 126ac71f authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

changed process_t member oargv from type char** to std::vector<char*>

parent 04be33f7
...@@ -749,8 +749,7 @@ processDefArgument(void *vargument) ...@@ -749,8 +749,7 @@ processDefArgument(void *vargument)
process_t &process = processSelf(); process_t &process = processSelf();
char *operatorArg; char *operatorArg;
char *commapos; char *commapos;
int oargc = 0; std::vector<char*> &oargv = process.oargv;
char **oargv = process.oargv;
int argc = ((argument_t *) vargument)->argc; int argc = ((argument_t *) vargument)->argc;
std::vector<char *> &argv = ((argument_t *) vargument)->argv; std::vector<char *> &argv = ((argument_t *) vargument)->argv;
...@@ -761,22 +760,20 @@ processDefArgument(void *vargument) ...@@ -761,22 +760,20 @@ processDefArgument(void *vargument)
if (operatorArg) if (operatorArg)
{ {
oargv[oargc++] = operatorArg; oargv.push_back(operatorArg);
// fprintf(stderr, "processDefArgument: %d %s\n", oargc, operatorArg); // fprintf(stderr, "processDefArgument: %d %s\n", oargc, operatorArg);
commapos = operatorArg; commapos = operatorArg;
while ((commapos = strchr(commapos, ',')) != NULL) while ((commapos = strchr(commapos, ',')) != NULL)
{ {
*commapos++ = '\0'; *commapos = '\0';
*commapos++;
if (strlen(commapos)) if (strlen(commapos))
{ {
if (oargc >= MAX_OARGC) oargv.push_back(commapos);
cdoAbort("Too many parameter (limit=%d)!", MAX_OARGC);
oargv[oargc++] = commapos;
} }
} }
process.oargc = oargc; process.oargc = oargv.size();
} }
processDefPrompt(process.operatorName); processDefPrompt(process.operatorName);
...@@ -850,7 +847,7 @@ operatorArgc(void) ...@@ -850,7 +847,7 @@ operatorArgc(void)
char ** char **
operatorArgv(void) operatorArgv(void)
{ {
return processSelf().oargv; return &processSelf().oargv[0];
} }
void void
......
...@@ -67,7 +67,7 @@ class process_t { ...@@ -67,7 +67,7 @@ class process_t {
const char *operatorName; const char *operatorName;
char *operatorArg; char *operatorArg;
int oargc; int oargc;
char *oargv[MAX_OARGC]; std::vector<char *> oargv;
char prompt[64]; char prompt[64];
short noper; short noper;
oper_t oper[MAX_OPERATOR]; oper_t oper[MAX_OPERATOR];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment