This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add open_wmemstream


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?


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]