Skip to contentSkip to conversation

ALSA: emu10k1_patch: Use swap macro in snd_emu10k1_sample_new

PATCH Applied Gustavo A. R. Silva 2 participants 2 messages Jul 17, 2018 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: emu10k1_patch: Use swap macro in snd_emu10k1_sample_new

Make use of the swap macro and remove unnecessary variable *tmp*. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

---
 sound/pci/emu10k1/emu10k1_patch.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
sound/pci/emu10k1/emu10k1_patch.c +2 -5
index 0e069ae..c32eb70 100644
@@ -70,11 +70,8 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp,
 		loopend = sampleend;
 
 	/* be sure loop points start < end */
-	if (sp->v.loopstart >= sp->v.loopend) {
-		int tmp = sp->v.loopstart;
-		sp->v.loopstart = sp->v.loopend;
-		sp->v.loopend = tmp;
-	}
+	if (sp->v.loopstart >= sp->v.loopend)
+		swap(sp->v.loopstart, sp->v.loopend);
 
 	/* compute true data size to be loaded */
 	truesize = sp->v.size + BLANK_HEAD_SIZE;
Signature · 1 line
2.7.4
Applied
#1 lore raw
Quoted 7 lines · Gustavo A. R. Silva

Make use of the swap macro and remove unnecessary variable *tmp*. This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Applied, thanks.

Takashi