Matt Roth wrote:

How desirable is the replacement of malloc() + memset() with calloc() calls? I'm seeing this behavior in a lot of places, so if it should generally be avoided in favor of calloc() I'll submit some patches.

It's on the list, although Russell has some stuff he's been working on to abstract it even more. Find him on IRC to ask about it.

What about the use of strncpy()? Is ast_copy_string() meant to be a wholesale replacement or does strncpy() still have its place?

Only when the entire source string is being copied; the semantics of ast_copy_string have not been confirmed to be the same as strncpy when only a portion of the source string is being copied... it may very well be usable in that case too.

The differences between the two are that ast_copy_string does _not_ zero-fill the destination buffer, and it _does_ guarantee that the resulting string will always be zero-terminated. Otherwise they perform the same operations.
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Dev mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to