On Wed, Jun 21, 2006 at 01:20:24AM -0700, Matthew Dillon wrote: > A memdup that is not string-oriented is a fine idea, but it > would not be something we would add to libc unless there were > a pre-existing reasonably standardized function somewhere that > did that sort of operation. It's only a few lines of code but > the problem vis-a-vie putting things into libc is standardization.
For memdup there is precedence. The situation is a bit different for that, since it does fill a hole (copying memory buffer). I don't like strndup, since the meaning of "copy string up to a fixed length" is asking for trouble. It doesn't allow to check for truncation without killing the original intent. Ignoring truncation created enough problems in the past already, let's not create another API for that. Joerg
