[PATCH] Add open_wmemstream
Jeff Johnston
jjohnstn@redhat.com
Wed Feb 18 18:04:00 GMT 2009
Corinna Vinschen wrote:
> On Feb 17 20:05, Eric Blake wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> According to Corinna Vinschen on 2/17/2009 10:22 AM:
>>
>>> Hi,
>>>
>>>
>>> I have added open_wmemstream per SUSv4 to the newlib implementation of
>>> open_memstream. The patch is attached below. Is the implementation
>>> correct? IIUC, the size parameter gets the size in wchars in case of
>>> having opened the memstream with open_wmemstream. I hope I got that
>>> right.
>>>
>> Yes, that is how I read the spec.
>>
>>
>>> - char saved; /* saved character that lived at *psize before NUL */
>>> + union {
>>> + char c;
>>> + wchar_t w;
>>> + } saved; /* saved character that lived at *psize before NUL */
>>> + int wide; /* wide-oriented (>0) or byte-oriented (<0) */
>>>
>> If wchar_t is 16 bits (as on cygwin), these last two fields occupy 64
>> bits. I suggest using 'char wide' instead, since it reduces the size
>> requirement to 32 bits.
>>
>
> Thanks for the hint. I changed the type of wide to int8_t in my local
> patch.
>
>
>> Beyond that, the patch looked fine to me.
>>
>
> Thanks for the review.
>
> Jeff, ok to apply?
>
>
>
Yes, please go ahead and thanks.
-- Jeff J.
> Corinna
>
>
More information about the Newlib
mailing list