XP_MAC: improved nsDLL::Load() to not call PL_strlen() each time through a loop from 0 to the length of the string - 1.

git-svn-id: svn://10.0.0.236/trunk@30907 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beard%netscape.com 1999-05-10 03:45:38 +00:00
parent cf98d02097
commit 3d595b23e2
2 changed files with 16 additions and 16 deletions

View File

@ -104,11 +104,6 @@ nsDll::~nsDll(void)
PRBool nsDll::Load(void)
{
#ifdef XP_MAC
char *macFileName = NULL;
int loop;
#endif
if (m_status != DLL_OK)
{
return (PR_FALSE);
@ -120,13 +115,18 @@ PRBool nsDll::Load(void)
}
#ifdef XP_MAC
// err = ConvertUnixPathToMacPath(m_fullpath, &macFileName);
if ((macFileName = PL_strdup(m_fullpath)) != NULL)
char *macFileName = PL_strdup(m_fullpath);
if (macFileName != NULL)
{
if (macFileName[0] == '/')
{
for (loop=0; loop<PL_strlen(macFileName); loop++)
// convert '/' to ':'
int c;
char* str = macFileName;
while ((c = *str++) != 0)
{
if (macFileName[loop] == '/') macFileName[loop] = ':';
if (c == '/')
str[-1] = ':';
}
m_instance = PR_LoadLibrary(&macFileName[1]); // skip over initial slash
}

View File

@ -104,11 +104,6 @@ nsDll::~nsDll(void)
PRBool nsDll::Load(void)
{
#ifdef XP_MAC
char *macFileName = NULL;
int loop;
#endif
if (m_status != DLL_OK)
{
return (PR_FALSE);
@ -120,13 +115,18 @@ PRBool nsDll::Load(void)
}
#ifdef XP_MAC
// err = ConvertUnixPathToMacPath(m_fullpath, &macFileName);
if ((macFileName = PL_strdup(m_fullpath)) != NULL)
char *macFileName = PL_strdup(m_fullpath);
if (macFileName != NULL)
{
if (macFileName[0] == '/')
{
for (loop=0; loop<PL_strlen(macFileName); loop++)
// convert '/' to ':'
int c;
char* str = macFileName;
while ((c = *str++) != 0)
{
if (macFileName[loop] == '/') macFileName[loop] = ':';
if (c == '/')
str[-1] = ':';
}
m_instance = PR_LoadLibrary(&macFileName[1]); // skip over initial slash
}