Plan 9 from Bell Labs’s /usr/web/sources/contrib/yk/dist/9legacy/applied/libc-fmt-rune.diff

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


--- /sys/src/libc/fmt/fmt.c
+++ /sys/src/libc/fmt/fmt.c
@@ -10,7 +10,7 @@ enum
 typedef struct Convfmt Convfmt;
 struct Convfmt
 {
-	int	c;
+	Rune	c;
 	volatile	Fmts	fmt;	/* for spin lock in fmtfmt; avoids race due to write order */
 };
 
@@ -57,7 +57,7 @@ int	(*doquote)(int);
  * _fmtlock() must be set
  */
 static int
-_fmtinstall(int c, Fmts f)
+_fmtinstall(Rune c, Fmts f)
 {
 	Convfmt *p, *ep;
 
@@ -95,10 +95,13 @@ fmtinstall(int c, Fmts f)
 }
 
 static Fmts
-fmtfmt(int c)
+fmtfmt(Rune c)
 {
 	Convfmt *p, *ep;
 
+	if (c == '\0')
+		return _badfmt;
+
 	ep = &fmtalloc.fmt[fmtalloc.nfmt];
 	for(p=fmtalloc.fmt; p<ep; p++)
 		if(p->c == c){

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].