2006/12/13, Gregory Shimansky <[EMAIL PROTECTED]>:
Tim Ellison wrote:
> Alexey Varlamov wrote:
>> Is there any reason to distinguish these cases? I suppose no, then
>> returned NULL is fine.
>
> Maybe we do, i.e. where there is no value "-Dfoobar". So perhaps we
> need to say that GetSystemProperty returns VMI_ERROR_NONE and sets the
> the *valuePtr to NULL if there is no value; and returns a
> VMI_ERROR_NOT_FOUND if the property is undefined.
Now I am confused. What is the difference between a property which has
no value and an undefined property?
Some properties may act as a flag, e.g. -Djava.lang.SecurityManager.
However, they have empty value in RI (interestingly, DRLVM ignores
such arguments - must be a bug). So NULL value is still enough to
indicate no such property is set.
> You can also see if it is defined by using the IterateSystemProperties
> to look for it.
>
> Index: luni/src/main/native/include/shared/vmi.h
> ===================================================================
> --- luni/src/main/native/include/shared/vmi.h (revision 486569)
> +++ luni/src/main/native/include/shared/vmi.h (working copy)
> @@ -220,7 +220,13 @@
>
> /**
> * @fn VMInterfaceFunctions_::GetSystemProperty(VMInterface * vmi,
> char *key, char **valuePtr)
> - * Retrieve the value of a VM system property.
> + * Retrieve the value of a VM system property.
> + * If the property is not set this function returns
> VMI_ERROR_NOT_FOUND and the value
> + * of *valuePtr is undefined.
> + * If the property is set, but has no value then the function returns
> VMI_ERROR_NONE and
> + * the *valuePtr will be NULL.
> + * If the property is set and has a value then the function returns
> VMI_ERROR_NONE and
> + * the *valuePtr will be the address of the string value.
> *
> * @note The returned string is owned by the VM, and should not be freed.
> */
>
>
> Regards,
> Tim
>
--
Gregory