Skip to content

Commit

Permalink
minor refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
eadmaster authored and eadmaster committed Jan 7, 2021
1 parent 1661a07 commit 9b3dafc
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tasks/task_patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ bool patch_content(
bool allow_ups = !is_bps_pref && !is_ips_pref;
bool allow_ips = !is_ups_pref && !is_bps_pref;
bool allow_bps = !is_ups_pref && !is_ips_pref;
int i = 1;

if ( (unsigned)is_ips_pref
+ (unsigned)is_bps_pref
Expand All @@ -755,17 +756,18 @@ bool patch_content(
return false;
}

int i = 1;
while ( try_ips_patch(allow_ips, name_ips, buf, size)
|| try_bps_patch(allow_bps, name_bps, buf, size)
|| try_ups_patch(allow_ups, name_ups, buf, size))
for (i = 1; i < 10; i++)
{
/* a valid patch file was found, switch to the next patch by changing the last char of the name string */
i++;
if(i==10) break;
name_ips[strlen(name_ips)-1] = '0'+i;
name_bps[strlen(name_bps)-1] = '0'+i;
name_ups[strlen(name_ups)-1] = '0'+i;
if ( !try_ips_patch(allow_ips, name_ips, buf, size)
&& !try_bps_patch(allow_bps, name_bps, buf, size)
&& !try_ups_patch(allow_ups, name_ups, buf, size))
break;

/* else a valid patch file was found, switch to the next patch by changing the last char of the name string */
i++;
name_ips[strlen(name_ips)-1] = '0'+i;
name_bps[strlen(name_bps)-1] = '0'+i;
name_ups[strlen(name_ups)-1] = '0'+i;
}

if( i == 1 )
Expand Down

0 comments on commit 9b3dafc

Please sign in to comment.