Function naming and overloading (was: paranoid malloc checker forced on)

David Collier-Brown David.Collier-Brown at Sun.COM
Wed May 4 16:18:58 GMT 2005

  Hmmn, I sorta wonder if SMB_STRDUP, sys_strdup, snoodgie_strdup and
the like are as much part of the problem as the solution...

  The old C language approach was to overload the name, changing it
only if forced to (e.g., lseek instead of seek). I wonder if
it would be better to overload strdup than define a new interface?
That can be done with #define for any non-varargs function, and
with a #define and pointer-to-function otherwise...

  So: opinions please!
  If overloading was both free and reliable, would you prefer it to 
renaming the interface?
  I'll summarize to the list.


Jeremy Allison wrote:
> On Wed, May 04, 2005 at 08:02:05AM -0400, Jim McDonough wrote:
>>Ok, with Volker's talloc change, now the paranoid malloc checker is forced
>>on.  We've now got build breakage any time there is strdup (ok, I can
>>understand this) or even strndup (I don't follow this).   What are we
>>supposed to use in this case?  have we replaced it with something?
> No this is my bug (I tested with it and forgot to
> turn it off on commit). Just turn it off (but you
> should be using SMB_STRDUP / SMB_STRNDUP).
> Jeremy.

David Collier-Brown,      | Always do right. This will gratify
Sun Microsystems, Toronto | some people and astonish the rest
davecb at     |                      -- Mark Twain
(416) 263-5733 (x65733)

More information about the samba-technical mailing list