A coding challenge wants you

Derek Atkins warlord at MIT.EDU
Mon Feb 12 12:30:09 EST 2007


Martin Preuss <aquamaniac at gmx.de> writes:

> Hi,
>
> On Monday 12 February 2007 02:06, Andreas Köhler wrote:
> [...]
>> priority queue is to make GnuCash read and write compressed data files.
>> The porting here is not trivial, because the current code uses fork(2),
>> a concept not available on Windows.  The parent process just writes|reads
>> to|from the child process which uses libz to (de)compress the data.
> [...]
> Just curious: Why is that so? Why does Gnucash need a new process/thread for 
> just decompressing the file? Couldn't Gnucash just link against libz and 
> decompress the file itself?

Because the XML parser code is expecting a file descriptor.

We /do/ link to libz and decompress the file ourself, but we do it in
a forked process that just calls into libz.  See the code in
src/backend/file/io-gncxml-v2.c and look for fork(). Changing this
from a fork() to a g_thread() should make the code work without
major changes and should be relatively straightforward.

> Regards
> Martin

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list