On Wed, 11 May 2022 14:27:27 GMT, Kim Barrett <[email protected]> wrote:
>> src/java.base/share/native/libjli/java.c line 1629:
>>
>>> 1627: const char *arg = jargv[i];
>>> 1628: if (arg[0] == '-' && arg[1] == 'J') {
>>> 1629: *nargv++ = (arg[2] == '\0') ? NULL : JLI_StringDup(arg +
>>> 2);
>>
>> Wow!
>
> I wonder if the client expects NULL strings in the result, or if the NULL
> value should be an empty string? If empty strings are okay, this would be
> simpler without the conditional, just dup from arg + 2 to the terminating
> byte (which might be immediate).
`NULL` affects as a loop stopper in `ParseArguments()` as following:
static jboolean
ParseArguments(int *pargc, char ***pargv,
int *pmode, char **pwhat,
int *pret, const char *jrepath)
{
int argc = *pargc;
char **argv = *pargv;
int mode = LM_UNKNOWN;
char *arg;
*pret = 0;
while ((arg = *argv) != 0 && *arg == '-') {
But I'm not sure it is valid, I think it might be discussed as another issue.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8646