diff options
author | Graydon, Tracy <tracy.graydon@intel.com> | 2013-01-31 17:08:15 -0800 |
---|---|---|
committer | Graydon, Tracy <tracy.graydon@intel.com> | 2013-01-31 17:08:15 -0800 |
commit | 699fc9f67a9a62df492d1cd049e4978953640de9 (patch) | |
tree | f0c16f1494bd71922e7bf5258037427cac4a350b /compat/strlcpy.c | |
download | git-2.0alpha.tar.gz git-2.0alpha.tar.bz2 git-2.0alpha.zip |
Initial commit for TizenHEADsubmit/2.0alpha/20130201.014617accepted/2.0alpha/20130201.0121062.0alpha
Diffstat (limited to 'compat/strlcpy.c')
-rw-r--r-- | compat/strlcpy.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/strlcpy.c b/compat/strlcpy.c new file mode 100644 index 0000000..4024c36 --- /dev/null +++ b/compat/strlcpy.c @@ -0,0 +1,13 @@ +#include "../git-compat-util.h" + +size_t gitstrlcpy(char *dest, const char *src, size_t size) +{ + size_t ret = strlen(src); + + if (size) { + size_t len = (ret >= size) ? size - 1 : ret; + memcpy(dest, src, len); + dest[len] = '\0'; + } + return ret; +} |