Plan 9 from Bell Labs’s /usr/web/sources/extra/changes/2005/1026

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


Allocate enough space for tiny arguments.
 [jmk] --rw-rw-r-- M 284650 glenda sys 4490 Oct 26 20:52 sys/src/libc/fmt/fltfmt.c
	/n/sourcesdump/2005/1026/plan9/sys/src/libc/fmt/fltfmt.c:8,13 - 
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/fmt/fltfmt.c:8,14
	  	FDIGIT	= 30,
	  	FDEFLT	= 6,
	  	NSIGNIF	= 17,
	+ 	NEXP10	= 308,
	  };
	  
	  static int
	/n/sourcesdump/2005/1026/plan9/sys/src/libc/fmt/fltfmt.c:294,301 - 
	/n/sourcesdump/2005/1027/plan9/sys/src/libc/fmt/fltfmt.c:295,307
	  int
	  _floatfmt(Fmt *fmt, double f)
	  {
	- 	char s[FDIGIT+10];
	+ 	char s[1+NEXP10+1+FDIGIT+1];
	  
	+ 	/*
	+ 	 * The max length of a %f string is
	+ 	 *	'[+-]'+"max exponent"+'.'+"max precision"+'\0'
	+ 	 * which is 341 currently.
	+ 	 */	
	  	xdtoa(fmt, s, f);
	  	fmt->flags &= FmtWidth|FmtLeft;
	  	_fmtcpy(fmt, s, strlen(s), strlen(s));


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.