[cairo] Using OS/2 memory allocation APIs
behdad at behdad.org
Wed Nov 21 22:24:22 PST 2007
On Tue, 2007-11-20 at 14:33 +0100, Peter Weilbacher wrote:
> So, what do you suggest how I should solve the problem instead? If your
> suggestion is "change the C library" then I can tell you upfront that I
> don't have that choice...
> Are you even against adding the patch I posted, i.e. to have it fully
> contained within cairo-os2-surface.c?
> And about the different free function: in the cases that I have pointed
> out (I could give more detail) there is always a function that allocates
> stuff and a corresponding function that frees stuff. So it's not like
> for those allocations I would need to add the DosAllocMem() in one file
> and the corresponding DosFreeMem() in another one or even worse several
> other ones.
>  One other possibility would be to use C library functionality to
> create additional heaps, but that would need even more lines and be
> way more ugly...
Sorry, I didn't notice that all the changes are indeed in
cairo-os2-surface.c only. So, yes, you are in fact free to just go
ahead and commit those, becase OS/2 is not a supported backend and by
all means you are the maintainer and get to choose what to do.
But if you ask for my advice, I suggest adding a couple functions for
the allocations that you may want to accommodate using an alternate
allocator and do the #ifdef magic just in that function. That should
make the patch much more comprehensible and maintainable. Call it
something _alloc_buffer() and _free_buffer() for example.
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo