Revision 2ecf3cee0754961401200e9f35071001ccdbbce3 authored by Junio C Hamano on 03 July 2007, 06:29:54 UTC, committed by Junio C Hamano on 03 July 2007, 06:29:54 UTC
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent fcb10a9
Raw File
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