]> granicus.if.org Git - strace/commit
xstrdup, xtrndup: allow NULL argument
authorEugene Syromiatnikov <evgsyr@gmail.com>
Thu, 24 Aug 2017 17:36:08 +0000 (17:36 +0000)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 24 Aug 2017 18:06:54 +0000 (20:06 +0200)
commit7ba0d89c9f9710bb550201436840079fb71b18be
tree4d5ecf0035de59decf5cef3e30f547fe75569fd1
parent2b786e0113c105e2434d4e9069797321628b4ab3
xstrdup, xtrndup: allow NULL argument

Accept NULL argument in xstrdup and xtrndup functions to allow use
of "xstrdup(str)" instead of "str ? xstrdup(str) : NULL".

* xmalloc.c (xstrdup, xstrndup): Handle NULL argument.
* xmalloc.h: Add comment regarding this deviation from the behaviour
of the POSIX counterparts of these functions.
xmalloc.c
xmalloc.h