[sane-devel] [patch] fix SANE_Device
Sat, 13 Nov 2004 14:26:17 -0600
Henning Meier-Geinitz wrote:
> On Sat, Nov 13, 2004 at 01:28:16PM -0600, Frank Zago wrote:
>>This patch removes the const from the name strings in SANE_Device.
>>I didn't commit it because it might breaks stuff.
> Be careful. SANE-Device is part of the SANE standard, so that would
> need to be changed also.
>>However, I believe the new definition is actually correct.
> I guess the idea was that the strings shouldn't be changed after the
> SANE-Device pointer is returned to the frontend.
Thsi behaviour should be made clear in the doc. To me, const means something else.
Since this patch makes the variable from const to non-const, I don't think it
will break anything.
> As far as I can see the trouble results from doing things like
> sane.name = strdup (...) and freeing those in sane_exit().
That is correct. I think it's clear from the use of that field that the const
creates more trouble than it solves.