Page MenuHomeFreeBSD

stdio: *memstream: slightly streamline growth function
AcceptedPublic

Authored by kevans on Fri, May 29, 11:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 10, 9:02 AM
Unknown Object (File)
Mon, Jun 8, 9:19 AM
Unknown Object (File)
Sat, Jun 6, 9:07 PM
Unknown Object (File)
Fri, Jun 5, 9:51 PM
Unknown Object (File)
Fri, Jun 5, 9:47 PM
Unknown Object (File)
Thu, Jun 4, 10:19 AM
Unknown Object (File)
Wed, Jun 3, 11:28 PM
Unknown Object (File)
Mon, Jun 1, 12:32 PM
Subscribers

Details

Reviewers
jhb
des
Group Reviewers
Klara
Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73564
Build 70447: arc lint + arc unit

Event Timeline

des added a subscriber: des.

afaict the only difference between these files is wchar_t vs char. I wonder if we should merge them.

This revision is now accepted and ready to land.Wed, Jun 3, 12:55 PM
In D57353#1315249, @des wrote:

afaict the only difference between these files is wchar_t vs char. I wonder if we should merge them.

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.