Rémi Bernon (@rbernon) commented about dlls/dmsynth/synth.c:
*out_region = region; break; }}
Like splitting the helper like this:
```suggestion:-27+0 static struct region *find_instrument_region(struct instrument *instrument, int key, int vel) { struct region *region;
LIST_FOR_EACH_ENTRY(region, &instrument->regions, struct region, entry) { if (key < region->key_range.usLow || key > region->key_range.usHigh) continue; if (vel < region->vel_range.usLow || vel > region->vel_range.usHigh) continue; return region; }
return NULL; }
static struct instrument *find_instrument(struct synth *synth, int patch) { struct instrument *instrument;
LIST_FOR_EACH_ENTRY(instrument, &synth->instruments, struct instrument, entry) if (instrument->patch == patch) return instrument;
return NULL; }
static struct region *find_region(struct synth *synth, int patch, int key, int vel, struct instrument **instrument) { struct region *region = NULL;
if ((*instrument = find_instrument(synth, patch))) region = find_instrument_region(*instrument, key, vel); if (!region && (patch & 0x80000000) && (*instrument = find_instrument(synth, 0x80000000))) region = find_instrument_region(*instrument, key, vel);
return region; } ```