Inverting the condition after realloc*() is a minor cleanup, but makes
the success path a little cleaner to ease a future change.
Sponsored by: Klara, Inc.
Differential D57353
stdio: *memstream: slightly streamline growth function Authored by kevans on Fri, May 29, 11:43 PM. Tags None Referenced Files
Details
Diff Detail
Event TimelineComment Actions afaict the only difference between these files is wchar_t vs char. I wonder if we should merge them. Comment Actions There's some other small differences like having to use mbrlen, but I don't think that's a huge obstacle and it'd be good to merge them -- it just requires a little more thought into the abstractions we need. I think converting the non-wide version to reallocarray and introducing a MEMCHAR_TYPE (or whatever) gets you most of the way there- we can probably take most of the wmemstream implementation and assume that the compiler will just optimize away a lot of the differences when it's dealing with a fixed-width byte input to the stream. |