Eric Blake <ebl...@redhat.com> writes: > On 02/21/2013 02:11 AM, Christian Egli wrote: >> Hi all >> >> I would like to use xalloc in liblouis[1] a library (and a couple of >> programs) for braille transcription. The main author just sprinkled the >> library code with stuff like >> >> foo = malloc(FOO_SIZE); >> if (!foo) >> outOfMemory(); >> >> I would like to replace this with xmalloc. However it appears that >> xalloc is GPL. Would it be possible to relicense this under LGPLv3? > > The point of xalloc is generally to exit on error; but libraries should > never exit. The choice of GPL is intentional, to discourage libraries > from using an interface that is not appropriate in library design. You > really ought to be fixing liblouis so that it returns a clean error > indication to the user, instead of aborting their program.
Ah, I wasn't aware of that. The current outOfMemory function provided by liblouis just exits anyway[1], so I thought we might as well replace it with xalloc. > > I suppose that you could provide your own alternative xalloc_die() that > doesn't die, but merely longjmp()s out of your allocation attempt and > back to the entry point of your library; at which point xalloc() calling > into your xalloc_die() might be able to be made library-safe; but it > just feels like a lot of work, especially if your outOfMemory() call > already in your code can do the same longjmp unwinding without using xalloc. I wish it could do that. Most of the mallocs did not even check the result previous to the recent changes[2]. I guess some problems with the java bindings and actually bringing the jvm down triggered these recent changes in the code to check the results of malloc. Thanks Christian Footnotes: [1] http://code.google.com/p/liblouis/source/browse/trunk/liblouis/compileTranslationTable.c#130 [2] http://code.google.com/p/liblouis/source/detail?r=922 -- Christian Egli Swiss Library for the Blind, Visually Impaired and Print Disabled Grubenstrasse 12, CH-8045 Zürich, Switzerland