[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3)
- From: William Ahern <william@...>
- Date: Tue, 22 Apr 2014 11:56:16 -0700
On Mon, Apr 21, 2014 at 08:17:57PM -0700, Coroutines wrote:
> On Mon, Apr 21, 2014 at 5:30 PM, William Ahern
> <william@25thandclement.com> wrote:
>
> > The C stack. Here's the luaL_Buffer definition:
> >
> > typedef struct luaL_Buffer {
> > char *b; /* buffer address */
> > size_t size; /* buffer size */
> > size_t n; /* number of characters in buffer */
> > lua_State *L;
> > char initb[LUAL_BUFFERSIZE]; /* initial buffer */
> > } luaL_Buffer;
> >
> >
>
> ahh I see, so for strings larger than LUAL_BUFFERSIZE it fills the
> initb and puts the rest in heap storage, then computes the hash for
> pooling over both areas?
When initb is filled** it moves the entire buffer over to a heap allocated
block. It never uses multiple blocks to store buffer contents. For Lua 5.2
you can see the logic in luaL_prepbuffsize in lauxlib.c near line 437.
** Or, in the case of luaL_prepbuffer, when as much as a single byte has
already been written to initb, because luaL_prepbuffer guarantees
LUAL_BUFFERSIZE bytes of contiguous space.
- References:
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Sean Conner
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Dirk Laurie
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Sean Conner
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Dirk Laurie
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Sean Conner
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Coroutines
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Roberto Ierusalimschy
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Coroutines
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), William Ahern
- Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3), Coroutines