Changed isolated for loops to while loops (based on a patch by Andreas

Mohr).
oldstable
Alexandre Julliard 2001-03-05 19:34:17 +00:00
parent b6474aebd4
commit 566a52ad8c
8 changed files with 20 additions and 14 deletions

View File

@ -591,7 +591,10 @@ static BOOL MMIO_Destroy(LPWINE_MMIO wm)
LPWINE_MMIO* m;
EnterCriticalSection(&iData->cs);
for (m = &(iData->lpMMIO); *m && *m != wm; m = &(*m)->lpNext);
/* search for the matching one... */
m = &(iData->lpMMIO);
while (*m && *m != wm) m = &(*m)->lpNext;
/* ...and destroy */
if (*m) {
*m = (*m)->lpNext;
HeapFree(GetProcessHeap(), 0, wm);

View File

@ -261,10 +261,12 @@ static void DOSFS_ToDosDTAFormat( LPCSTR name, LPSTR buffer )
char *p;
memcpy( buffer, name, 8 );
for (p = buffer + 8; (p > buffer) && (p[-1] == ' '); p--);
p = buffer + 8;
while ((p > buffer) && (p[-1] == ' ')) p--;
*p++ = '.';
memcpy( p, name + 8, 3 );
for (p += 3; p[-1] == ' '; p--);
p += 3;
while (p[-1] == ' ') p--;
if (p[-1] == '.') p--;
*p = '\0';
}

View File

@ -1422,7 +1422,7 @@ BOOL WINAPI GetVolumeInformationA( LPCSTR root, LPSTR label,
if (label)
{
lstrcpynA( label, DRIVE_GetLabel(drive), label_len );
for (cp = label; *cp; cp++);
cp = label + strlen(label);
while (cp != label && *(cp-1) == ' ') cp--;
*cp = '\0';
}

View File

@ -957,11 +957,9 @@ static BOOL LFD_ComposeLFD( const fontObject* fo,
if (uRelax <= 4)
{
fontEncodingTemplate* boba;
i = fo->fi->fi_encoding >> 8;
for( boba = fETTable; i; i--, boba = boba->next );
fontEncodingTemplate* boba = fETTable;
for(i = fo->fi->fi_encoding >> 8; i; i--) boba = boba->next;
aLFD.charset_registry = boba->prefix ? boba->prefix : any;
i = fo->fi->fi_encoding & 255;

View File

@ -649,7 +649,8 @@ static VOID HLPFILE_SystemCommands(HLPFILE* hlpfile)
lstrcpy(p, (LPSTR) ptr + 4);
macro->lpszMacro = p;
macro->next = 0;
for (m = &hlpfile->first_macro; *m; m = &(*m)->next);
m = &hlpfile->first_macro;
while (*m) m = &(*m)->next;
*m = macro;
break;

View File

@ -443,7 +443,8 @@ void generate_startup_debug_events( struct process *process, void *entry )
generate_debug_event( thread, CREATE_THREAD_DEBUG_EVENT, NULL );
/* generate dll events (in loading order, i.e. reverse list order) */
for (dll = &process->exe; dll->next; dll = dll->next);
dll = &process->exe;
while (dll->next) dll = dll->next;
while (dll != &process->exe)
{
generate_debug_event( process->thread_list, LOAD_DLL_DEBUG_EVENT, dll );

View File

@ -1305,7 +1305,8 @@ static void load_keys( struct key *key, FILE *f )
while (read_next_line( &info ) == 1)
{
for (p = info.buffer; *p && isspace(*p); p++);
p = info.buffer;
while (*p && isspace(*p)) p++;
switch(*p)
{
case '[': /* new key */

View File

@ -120,12 +120,12 @@ const char *str_match (const char *str, const char *match, int *found)
{
assert(str && match && found);
for (; *str == ' '; str++);
while (*str == ' ') str++;
if (!strncmp (str, match, strlen (match)))
{
*found = 1;
str += strlen (match);
for (; *str == ' '; str++);
while (*str == ' ') str++;
}
else
*found = 0;