Changeset 3468 for trunk/src


Ignore:
Timestamp:
May 1, 2000, 1:28:42 AM (25 years ago)
Author:
phaller
Message:

Fix: PathFindFilename 3x faster now, just a test for the profiling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/shellpath.cpp

    r3257 r3468  
    1 /* $Id: shellpath.cpp,v 1.8 2000-03-28 15:28:52 cbratschi Exp $ */
     1/* $Id: shellpath.cpp,v 1.9 2000-04-30 23:28:42 phaller Exp $ */
    22
    33/*
     
    253253ODINFUNCTION1(LPCSTR, PathFindFilenameA,
    254254              LPCSTR, aptr)
    255 {  LPCSTR aslash;
    256    aslash = aptr;
    257 
    258    TRACE("%s\n",aslash);
    259    while (aptr[0])
    260    { if (((aptr[0]=='\\') || (aptr[0]==':')) && aptr[1] && aptr[1]!='\\')
    261          aslash = aptr+1;
    262      aptr++;
    263    }
    264    return aslash;
    265 
    266 }
     255{
     256  int iLength = strlen(aptr);
     257  LPSTR strSlash = (LPSTR)aptr + iLength - 1;
     258 
     259  while (iLength--)
     260  {
     261    if ( (*strSlash == '/' ) ||
     262         (*strSlash == '\\') )
     263      return strSlash + 1;
     264  }
     265 
     266  // no slash found, look for ":"
     267  if (aptr[1] == ':')
     268    return aptr+2;
     269 
     270  return aptr; // no slash and no drive found
     271}
     272
    267273ODINFUNCTION1(LPCWSTR, PathFindFilenameW,
    268274              LPCWSTR, wptr)
Note: See TracChangeset for help on using the changeset viewer.