On 08/17/2015 08:00 AM, Henry Jen wrote:
On Aug 17, 2015, at 7:10 AM, Henry Jen <henry....@oracle.com> wrote:
I think I may be talking at a different thing, guess you meant the make 
JLI_List JLI_PreprocessArg(const char*) to void JLI_PreprocessArg(JLI_List, 
const char*) and pass in a list to hold all the arguments.

That is reasonable. Considered that but didn’t do it eventually because not 
much benefits and hide the “expansion” fact. Since now you mentioned this, it 
probably worth to do it that way.

Now I remember another reason I didn’t do it, because of the wildcard 
processing in cmdtoargs.c. I don’t want to convert every platform to use StdArg 
or maintain different version of PreprocesArgs.

My suggestion is to keep JLI_PreprocessArg(const char* arg) is to return a non-null JLI_List. If the given arg is not @argfile, you return a static preallocated JLI_List with one single element and element[0] = JLI_StringDup(arg).

The change in main.c and cmdtoargs.c add the arguments in either a JLI_List or StdArg. For the non-@argfile case, you need to do JLI_StringDup explicitly. For @argfile case, JLI_StringDup is done before it returns JLI_List. I also suggest to add JLI_FreeList(JLI_List*, boolean shallow_free) that should special case the static preallocated JLI_List to clear the count and element and not to free that list.

I think that will simplify the code.

Mandy

Reply via email to