From 566a52ad8cf12be3a121b0a4f367d9e84f285c90 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 5 Mar 2001 19:34:17 +0000 Subject: [PATCH] Changed isolated for loops to while loops (based on a patch by Andreas Mohr). --- dlls/winmm/mmio.c | 5 ++++- files/dos_fs.c | 6 ++++-- files/drive.c | 2 +- graphics/x11drv/xfont.c | 8 +++----- programs/winhelp/hlpfile.c | 3 ++- server/debugger.c | 3 ++- server/registry.c | 3 ++- tools/specmaker/misc.c | 4 ++-- 8 files changed, 20 insertions(+), 14 deletions(-) diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index a23b36f5bff..87eada8dc00 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -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); diff --git a/files/dos_fs.c b/files/dos_fs.c index 5735c95698b..400223e78a4 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -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'; } diff --git a/files/drive.c b/files/drive.c index 6dc727afb86..d5a62f66df7 100644 --- a/files/drive.c +++ b/files/drive.c @@ -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'; } diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index b47d43b3931..579fc8f3a2e 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -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; diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c index 92cd6c0f404..c30621d1a9d 100644 --- a/programs/winhelp/hlpfile.c +++ b/programs/winhelp/hlpfile.c @@ -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; diff --git a/server/debugger.c b/server/debugger.c index f68cdf22c3a..eb86efebdd8 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -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 ); diff --git a/server/registry.c b/server/registry.c index 5905aba9989..f6a3f5e4eb1 100644 --- a/server/registry.c +++ b/server/registry.c @@ -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 */ diff --git a/tools/specmaker/misc.c b/tools/specmaker/misc.c index cdb3ae771f4..62231310eba 100644 --- a/tools/specmaker/misc.c +++ b/tools/specmaker/misc.c @@ -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; -- 2.11.4.GIT