https://github.com/git/git
Revision c415fb791b318832f52494b75d99602a7a8d604b authored by Junio C Hamano on 28 August 2015, 18:19:57 UTC, committed by Junio C Hamano on 28 August 2015, 18:19:57 UTC
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c3cb7b6
Raw File
Tip revision: c415fb791b318832f52494b75d99602a7a8d604b authored by Junio C Hamano on 28 August 2015, 18:19:57 UTC
Git 2.5.1
Tip revision: c415fb7
strlcpy.c
#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;
}
back to top