Sanjayan Ravi - 2013-12-17


I am trying to learn and understand the C code of lzma which is available from the LZMA SDK in 7zip website. I am not an expert in C programming so I am having a hard time understanding some functions.

One such function is the “LzmaEnc_Create” from the file LzmaEnc.c in the c code folder of lzma [line number 1700][].

I have copied the code of LzmaEnc_Create below.

CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc)


void *p;

printf("size of encode = %d\n",sizeof(CLzmaEnc));

p = alloc->Alloc(alloc, sizeof(CLzmaEnc));

if (p != 0)

LzmaEnc_Construct((CLzmaEnc *)p);

return p;


I would really appreciate any help provided to help me learn and understand this program.

Thank you!