[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: Dirk Laurie <dirk.laurie@...>
- Date: Sat, 19 Apr 2014 09:54:28 +0200
2014-04-19 8:55 GMT+02:00 Sean Conner <sean@conman.org>:
> It was thus said that the Great Dirk Laurie once stated:
>> 2014-04-18 22:28 GMT+02:00 Sean Conner <sean@conman.org>:
>>
>> > requires a C99 compiler
>>
>> Does POSIX.1-2001 compliance imply all of C99?
>
> I think POSIX only covers functions available, not langauge features. The
> problematic part of the code is:
>
> static int luametaiconv_iconv(lua_State *L)
> {
> const char *from;
> size_t fsize;
> iconv_t *pic;
>
> pic = luaL_checkudata(L,1,TYPE_ICONV);
> from = luaL_checklstring(L,2,&fsize);
>
> size_t rc;
> size_t tsize = fsize * 8; /* a reasonable guess here */
> char to[tsize];
> char *pto = to;
>
> I could hoise the variable declarations up above the two function calls,
> but I still have the variably size array to contend with, and frankly, with
> C99 being fifteen years old now, I want to use those features, damn it! I
> don't want to be held hostage to Microsoft, so I'm not changing the code.
Can't you do it with luaL_Buffer instead?