Big renaming of string buffer/formatting/conversion functions.

This commit is contained in:
Mike Pall
2013-05-13 10:15:07 +02:00
parent 625ffca739
commit 8f90a1279e
40 changed files with 395 additions and 356 deletions

View File

@@ -11,6 +11,7 @@
#include "lj_err.h"
#include "lj_str.h"
#include "lj_tab.h"
#include "lj_strfmt.h"
#include "lj_ctype.h"
#include "lj_ccallback.h"
@@ -568,16 +569,16 @@ GCstr *lj_ctype_repr_int64(lua_State *L, uint64_t n, int isunsigned)
/* Convert complex to string with 'i' or 'I' suffix. */
GCstr *lj_ctype_repr_complex(lua_State *L, void *sp, CTSize size)
{
char buf[2*LJ_STR_NUMBUF+2+1], *p = buf;
char buf[2*STRFMT_MAXBUF_NUM+2+1], *p = buf;
TValue re, im;
if (size == 2*sizeof(double)) {
re.n = *(double *)sp; im.n = ((double *)sp)[1];
} else {
re.n = (double)*(float *)sp; im.n = (double)((float *)sp)[1];
}
p = lj_str_bufnum(p, &re);
p = lj_strfmt_wnum(p, &re);
if (!(im.u32.hi & 0x80000000u) || im.n != im.n) *p++ = '+';
p = lj_str_bufnum(p, &im);
p = lj_strfmt_wnum(p, &im);
*p = *(p-1) >= 'a' ? 'I' : 'i';
p++;
return lj_str_new(L, buf, p-buf);