Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx-h.one.com (mx-h.one.com [91.198.169.55])
	by mail6.local (Postfix) with ESMTP id 29C5A8014FAE9
	for <filtered@awaresystems.be>; Tue, 21 May 2013 19:47:02 +0200 (CEST)
X-Virus-Scanned: by one.com
Received-SPF: pass (mx-h: domain of awaresystems.be+caf_=filtered=awaresystems.be@gmail.com designates 209.85.215.43 as permitted sender)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43])
	by mx-h.one.com (Postfix) with ESMTP id DAFC21F0AEEB
	for <filtered@awaresystems.be>; Tue, 21 May 2013 17:47:01 +0000 (UTC)
Received: by mail-la0-f43.google.com with SMTP id ez20so1006643lab.2
        for <filtered@awaresystems.be>; Tue, 21 May 2013 10:47:01 -0700 (PDT)
X-Received: by 10.112.131.129 with SMTP id om1mr1741458lbb.45.1369158421128;
        Tue, 21 May 2013 10:47:01 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.114.29.36 with SMTP id g4csp144021ldh;
        Tue, 21 May 2013 10:47:00 -0700 (PDT)
X-Received: by 10.112.167.2 with SMTP id zk2mr2060856lbb.83.1369158418941;
        Tue, 21 May 2013 10:46:58 -0700 (PDT)
DomainKey-Status: bad format
Received-SPF: neutral (google.com: 91.198.169.52 is neither permitted nor denied by best guess record for domain of chris.liddell@artifex.com) client-ip=91.198.169.52;
Received: by 10.112.33.170 with POP3 id s10mf3135657lbi.29;
        Tue, 21 May 2013 10:46:58 -0700 (PDT)
X-Gmail-Fetch-Info: info@awaresystems.be 1 pop.awaresystems.be 110 info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-e.one.com (mx-e.one.com [91.198.169.52])
	by mail6.local (Postfix) with ESMTP id F1BEE8014FAE9
	for <info@awaresystems.be>; Tue, 21 May 2013 19:28:50 +0200 (CEST)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172])
	by mx-e.one.com (Postfix) with ESMTP id C2F15AB1B91
	for <info@awaresystems.be>; Tue, 21 May 2013 17:28:50 +0000 (UTC)
Received: by mail-we0-f172.google.com with SMTP id w62so500423wes.31
        for <info@awaresystems.be>; Tue, 21 May 2013 10:28:50 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=google.com; s=20120113;
        h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer
         :mime-version:content-type:content-transfer-encoding
         :x-gm-message-state;
        bh=3d6mpGlY0Fb+eR8Oop9bonB2CYMwVNPZGSOJoJS/Jr8=;
        b=k7cgTca1CcBScETBMJmokmcCsL1KjE+hCru4f6DD93NeQ2dW5RzH5/LauWy6lPKnGG
         nxuDBK/G6KSVcxYA92/jhO9U0nMQ/cSQeFTPl7yZIMJMr8xPT2iYzinLqn8/cq01DiT7
         UmwDBVNasp5ix8R3bxc4ESNjDgEuhqwrwQuuK7c4W2U3vDrhSmQRWu35DGh3K4wfp657
         3B7zDNo6VIGtnqeg26nnkVJurxv+T82M7kz0jz7BL0+nTHrRP13OZl8fFVQpK3KSMiME
         ZHMpYvcHDIA1Ayp9cVL3VUJKHL/J34MQwe4pLzp6pWpyLrpDSrfoKCVVnoaUrdswHhz7
         NLNg==
X-Received: by 10.180.37.109 with SMTP id x13mr25455963wij.20.1369157330534;
        Tue, 21 May 2013 10:28:50 -0700 (PDT)
Received: from paracelsus (cpc1-ando5-2-0-cust33.15-1.cable.virginmedia.com. [80.3.191.34])
        by mx.google.com with ESMTPSA id d5sm23429672wic.1.2013.05.21.10.28.49
        for <multiple recipients>
        (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
        Tue, 21 May 2013 10:28:50 -0700 (PDT)
Date: Tue, 21 May 2013 18:28:46 +0100
From: Chris Liddell <chris.liddell@artifex.com>
To: "Joris Van Damme (AWare Systems)" <info@awaresystems.be>
Cc: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>, Tiff List
 <tiff@lists.maptools.org>
Subject: Re: [Tiff] memory management function calls
Message-ID: <20130521182846.79b7e024@paracelsus>
In-Reply-To: <CA+NZCsQmpaFTiFGSD_sr1gkG4R=ds8aFPHY1jBnvMa+Kdp0RJw@mail.gmail.com>
References: <CAGy8pWr-M3oAt34iPaFFpQTKwrbGrQxzt1NKZsQKRLD_c+fYiw@mail.gmail.com>
	<alpine.GSO.2.01.1305210909030.2267@freddy.simplesystems.org>
	<20130521161103.52cedb63@paracelsus>
	<alpine.GSO.2.01.1305211015420.24050@freddy.simplesystems.org>
	<20130521163204.5902e827@paracelsus>
	<CA+NZCsQmpaFTiFGSD_sr1gkG4R=ds8aFPHY1jBnvMa+Kdp0RJw@mail.gmail.com>
X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.13; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Gm-Message-State: ALoCoQmQQBUCCGqlFT3NPy/fr/1km/0xKpZWWoA/kH3rqLXzraCnO0Z7evSSnt/5RH4FuMdMYJlX

On Tue, 21 May 2013 19:21:41 +0200
"Joris Van Damme (AWare Systems)" <info@awaresystems.be> wrote:

> Chris,
> 
> >> Yes, but then standard malloc/realloc/free type functions can not
> >> be specified directly.  Special wrapper functions would need to be
> >> added in order to support passing (and ignoring) the context
> >> before calling such functions.
> >
> > Sure, so the function pointer types for the callbacks would have
> > some kind of context pointer parameter
> 
> I've had the same problem when I added the context parameter to
> warning/error handler callbacks.
> 
> My solution was to support two sets of callbacks. One was the
> traditional set, without the context cookie parameter, the other was
> the new set with the additional parameter. The single point in the
> LibTiff library where the callback is actually called, it used the new
> callback with additional parameter if that callback is set. Otherwise,
> it calls the traditional handler without the additional context.
> 
> This way both needs are satisfied, people who require a context
> parameter set the new set of callbacks, people who require existing
> code to remain working without code change automatically stick with
> the old callbacks. It's a bit crufty and far fetched, but it does
> solve the problem. The only real disadvantage is that people hardly
> notice the option of using the new callbacks, so they kind of get
> forgotten and they may not work anymore a couple of versions down the
> line.

FWIW, Ghostscript now uses those callbacks, so thank you! And we, at
least, are testing them regularly.

In the case of memory management callbacks, since I don't have to
worry about old API callbacks, I'm inclined to add just one set, and
let those who don't need the context just ignore the parameter.

Chris


