[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: branches/work/kdelibs_kpassworddialog/KDE/kdelibs
From:       Thiago Macieira <thiago () kde ! org>
Date:       2007-01-06 4:58:41
Message-ID: 200701060258.42195.thiago () kde ! org
[Download RAW message or body]


Olivier Goffart wrote:
>The function signature can't be changed,  it's a callback which seems to
> be used by the cups API.
>But i don't know that code at all.
>I don't know what do do here,  redirect to the maintainer of that code ?

CUPS can't require a static string, so it must be a dynamic (malloc()ed) 
one in C libraries. Which means it must be freed somewhere.

Generally, C callbacks have an extra void* parameter that can be used for 
storing the context. Isn't this the case?

If it isn't, it's a very badly designed API. Really bad. You'd have to 
cope by strdup(2)ping the result of .toUtf8() and then freeing it from 
outside the CUPS function that you called. You must also make some 
external guarantee that this code will not reenter in another thread.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic