X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.h;h=29bf9d326ce17727b66bd18969c9d774110de184;hp=8c25e88b221ce26e9e9dcc036de1d09b56f6e2ec;hb=b0a8b273be0744ed445fbe6c935a04ee7a749f14;hpb=5abcb8724ac7046d62203ea643e9ce69f63a6a8a diff --git a/src/parser.h b/src/parser.h index 8c25e88..29bf9d3 100644 --- a/src/parser.h +++ b/src/parser.h @@ -13,6 +13,8 @@ #define BSIZE 256 #define PSI_T_POINTER PSI_T_ASTERISK +#define PSI_T_LONG_DOUBLE (PSI_T_DOUBLE << 16) + typedef int token_t; /* in php_psi.h */ @@ -82,7 +84,7 @@ static inline decl_type *init_decl_type_ex(token_t type, int argc, ...) { pos = all; ptr = realloc(ptr, 1 + (all += len)); } else { - ptr = malloc(ptr, 1 + (all = len)); + ptr = malloc(1 + (all = len)); } memcpy(ptr + pos, arg, len); } @@ -375,6 +377,10 @@ typedef struct decl_struct { char *name; decl_args *args; size_t size; + struct { + void *type; + void (*dtor)(void *type); + } engine; } decl_struct; static inline decl_struct *init_decl_struct(const char *name, decl_args *args) { @@ -1303,7 +1309,7 @@ static inline PSI_Token *PSI_TokenAlloc(PSI_Parser *P) { token_len = P->cur - P->tok; fname_len = strlen(P->psi.file.fn); - T = calloc(1, PSI_TokenAllocSize(token_len, fname_len); + T = calloc(1, PSI_TokenAllocSize(token_len, fname_len)); T->type = token_typ; T->size = token_len; T->text = &T->buf[0]; @@ -1343,7 +1349,7 @@ static inline PSI_Token *PSI_TokenCat(unsigned argc, ...) { T = realloc(T, PSI_TokenAllocSize(T->size + arg->size, fname_len)); memmove(&T->buf[T->size + 1], T->file, fname_len + 1); - memcpy(T->file - 1, arg->text, arg->size + 1) + memcpy(T->file - 1, arg->text, arg->size + 1); T->file = &T->buf[T->size + 1]; } else { T = PSI_TokenCopy(arg);