Index: trunk/src_3rd/load_cache/load_cache.c =================================================================== --- trunk/src_3rd/load_cache/load_cache.c (revision 757) +++ trunk/src_3rd/load_cache/load_cache.c (revision 758) @@ -141,3 +141,22 @@ htsp_pop(&ctx->files, file->name); ldch_free_file(ctx, file); } + +ldch_data_t *ldch_data_alloc(ldch_file_t *file, ldch_high_parser_t *high_parser, size_t payload_size) +{ + ldch_data_t *data = calloc(sizeof(ldch_data_t) - 1 + payload_size, 1); + data->parent = file; + data->high_parser = high_parser; + data->payload_size = payload_size; + return data; +} + +ldch_file_t *ldch_file_alloc(ldch_ctx_t *ctx, ldch_low_parser_t *low_parser, size_t low_payload_size) +{ + ldch_file_t *file = calloc(sizeof(ldch_file_t) - 1 + low_payload_size, 1); + file->parent = ctx; + file->low_parser = low_parser; + file->low_payload_size = low_payload_size; + return file; +} + Index: trunk/src_3rd/load_cache/load_cache.h =================================================================== --- trunk/src_3rd/load_cache/load_cache.h (revision 757) +++ trunk/src_3rd/load_cache/load_cache.h (revision 758) @@ -26,7 +26,7 @@ struct ldch_data_s { ldch_file_t *parent; ldch_high_parser_t *high_parser; - int payload_size; + size_t payload_size; char payload[1]; /* real size: payload_size (caches parsed data) */ }; @@ -36,7 +36,7 @@ vtp0_t data; /* -> (ldch_data_t *), indexed by high_parser uid */ void *user_data; ldch_low_parser_t *low_parser; - int low_payload_size; + size_t low_payload_size; char low_payload[1]; /* real size: low_payload_size (caches low level parsed data) */ }; @@ -62,3 +62,8 @@ void ldch_unload(ldch_ctx_t *ctx, ldch_file_t *file); + +/*** calls for parsers ***/ +ldch_data_t *ldch_data_alloc(ldch_file_t *file, ldch_high_parser_t *high_parser, size_t payload_size); +ldch_file_t *ldch_file_alloc(ldch_ctx_t *ctx, ldch_low_parser_t *low_parser, size_t low_payload_size); +