uint32 vallen = PL_strlen(regStr);
PRUint32 vallen = PL_strlen(regStr);
NS_IMETHODIMP nsRegistry::GetString( nsRegistryKey baseKey, const char *path, char **result ) {    nsresult rv = NS_OK;    REGERR   err = REGERR_OK;    // Make sure caller gave us place for result.    if ( !result )        return NS_ERROR_NULL_POINTER;    char   regStr[MAXREGPATHLEN];    // initialize the return value    *result = 0;    // Attempt to get string into our fixed buffer    PR_Lock(mregLock);    err = NR_RegGetEntryString( mReg,(RKEY)baseKey,(char*)path, regStr, sizeof regStr );    PR_Unlock(mregLock);    if ( err == REGERR_OK )    {        // Allocate buffer for return value        uint32 vallen = PL_strlen(regStr);        *result = (char*)PR_Malloc( vallen + 1 );        if (*result)            PL_strcpy(*result, regStr);        else            rv = NS_ERROR_OUT_OF_MEMORY;    }    else if ( err == REGERR_BUFTOOSMALL )     {        // find the real size and malloc it        uint32 length;        rv = GetValueLength( baseKey, path, &length );        // See if that worked.        if( rv == NS_OK )         {            *result =(char*)PR_Malloc( length + 1 );            if( *result )             {                // Get string from registry into result buffer.                PR_Lock(mregLock);                err = NR_RegGetEntryString( mReg,(RKEY)baseKey,(char*)path, *result, length+1 );                PR_Unlock(mregLock);                // Convert status.                rv = regerr2nsresult( err );                if ( rv != NS_OK )                {                    // Didn't get result, free buffer                    PR_Free( *result );                    *result = 0;                }            }            else            {                rv = NS_ERROR_OUT_OF_MEMORY;            }        }    }    else    {        // Convert status.        rv = regerr2nsresult( err );    }   return rv;}