Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

shellext/dirstate: refactor HgQueryDirstateDirectory

Introduce local var e for direntry inside for loop

Changeset 365c9c9fe186

Parent ca44ea97e583

by Adrian Buehlmann

Changes to one file · Browse files at 365c9c9fe186 Showing diff from parent ca44ea97e583 Diff from another changeset...

 
286
287
288
289
 
290
291
292
 
302
303
304
305
 
 
 
306
307
308
 
309
310
311
 
313
314
315
316
 
317
318
 
319
320
321
 
286
287
288
 
289
290
291
292
 
302
303
304
 
305
306
307
308
309
 
310
311
312
313
 
315
316
317
 
318
319
 
320
321
322
323
@@ -286,7 +286,7 @@
   int HgQueryDirstateDirectory(const char* hgroot, char* abspath, char* relpathloc, char* outStatus)  { - const dirstate* pd; + const dirstate* pd = 0;   struct _stat stat;     if (!HgQueryDirstate(hgroot, abspath, relpathloc, &pd, &stat)) @@ -302,10 +302,12 @@
    for (unsigned ix = 0; ix < pd->num_entries && !modified; ix++)   { - if (0 != strncmp(relpathloc, pd->entries[ix].name, len)) + const direntry& e = pd->entries[ix]; + + if (0 != strncmp(relpathloc, e.name, len))   continue;   - switch (pd->entries[ix].state) + switch (e.state)   {   case 'n':   if (!modified) @@ -313,9 +315,9 @@
  temp[0] = '\0';   strncat(temp, hgroot, MAX_PATH);   strcat(temp, "/"); - strncat(temp, pd->entries[ix].name, MAX_PATH); + strncat(temp, e.name, MAX_PATH);   if (0 == lstat(temp, &stat)) - modified = (mapdirstate(&pd->entries[ix], &stat) == 'M'); + modified = (mapdirstate(&e, &stat) == 'M');   }   break;   case 'm':