[Asterisk-Dev] Questions Regarding the ast_copy_string() Janitor
Project
Matt Roth
mroth at imminc.com
Tue Jan 10 12:01:08 MST 2006
Luigi,
>it's probably a leftover from previous code when strncpy was used.
>Probably safe to remove it.
>
>
In "probably safe" cases, what is the correct course of action? Should
I submit a bug report with a patch and allow the person to whom the bug
gets assigned sort out the details? I'm treating the janitor projects
as learning tools, but I'd like to be as helpful as possible at the same
time. I'm unclear on the etiquette so I'd appreciate any tips that
would prevent me from being a pain in the a**.
>i'd say yes. in this case the memset is a quick way to make sure
>the struct is consistently initialized. Many of them should
>disappear by replacing malloc() + memset() with calloc() calls.
>
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.
What about the use of strncpy()? Is ast_copy_string() meant to be a
wholesale replacement or does strncpy() still have its place?
Thanks for your responses,
Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer
More information about the asterisk-dev
mailing list