git: 9front

Download patch

ref: 4ea762bc821a4c5aa461a902c61369f486a7e0d4
parent: a3725097f53ab8521e31807b606cee84f0ce4173
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Dec 9 11:50:42 EST 2025

kernel: eliminate goto in dupseg() (bikeshedding)

Just merge the "sameseg: label" case into the switch
and let the cases fall into it, avoiding the goto.

--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -248,7 +248,11 @@
 	case SG_FIXED:
 	case SG_STICKY:
 	default:
-		goto sameseg;
+	sameseg:
+		incref(s);
+		qunlock(s);
+		poperror();
+		return s;
 
 	case SG_STACK:
 		n = newseg(s->type, s->base, s->size);
@@ -296,12 +300,6 @@
 	qunlock(s);
 	poperror();
 	return n;
-
-sameseg:
-	incref(s);
-	qunlock(s);
-	poperror();
-	return s;
 }
 
 /*
--