Revision d64ea0f83bd7e676778f833c57f969a94518a28d authored by Jeff King on 13 January 2015, 01:57:37 UTC, committed by Junio C Hamano on 13 January 2015, 18:03:30 UTC
It's a common idiom to duplicate a string if it is non-NULL, or pass a literal NULL through. This is already a one-liner in C, but you do have to repeat the name of the string twice. So if there's a function call, you must write: const char *x = some_fun(...); return x ? xstrdup(x) : NULL; instead of (with this patch) just: return xstrdup_or_null(some_fun(...)); Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 1da1e07
File | Mode | Size |
---|---|---|
lib | ||
macosx | ||
po | ||
windows | ||
.gitattributes | -rw-r--r-- | 170 bytes |
.gitignore | -rw-r--r-- | 97 bytes |
GIT-VERSION-GEN | -rwxr-xr-x | 1.8 KB |
Makefile | -rw-r--r-- | 11.4 KB |
git-gui--askpass | -rwxr-xr-x | 1.3 KB |
git-gui.sh | -rwxr-xr-x | 98.2 KB |
Computing file changes ...