ast icon indicating copy to clipboard operation
ast copied to clipboard

wcstoutf32s() is used exactly one place, has zero test coverage, and could be greatly simplified

Open krader1961 opened this issue 5 years ago • 2 comments

The wcstoutf32s() function is used exactly one place, has zero test coverage, and could be greatly simplified based on that sole use. In fact, it looks like it can be replaced by iswrune() and the comment before that sole use says as much. Apparently the only reason ksh is using wcstoutf32s() is because iswrune() isn't available on all platforms. So the solution is pretty obvious: Add a build time feature test for the availability of iswrune(). If it isn't provided use a fallback implementation.

krader1961 avatar Jul 06 '19 04:07 krader1961

FWIW, the wcstoutf32s() function did not exist in the ksh93u+ release. It is present in the ksh93v- code but is used in exactly one place. The same place that still exists in the current git head for the code and which can be replaced by iswrune(). Which means that as recently as 2013 the AST team thought their AST library would be adopted by a significant number of platforms for use by other code.

krader1961 avatar Jul 06 '19 06:07 krader1961

Not only does wcstooutf32s() not exist in the last stable release: ksh93u+. The function that calls it, sh_fmtstr(), does not exist in that release.

krader1961 avatar Jul 23 '19 06:07 krader1961