示例#1
0
char*	id_strdup(char* str)
{
	char*	ret;
	int	len;

	len = id_strlen(str);
	ret = malloc(sizeof(*ret) * (len + 1));
	if (!ret)
		return (0);
	ret = id_strcpy(ret, str);
	ret[len] = 0;
	return (ret);
}
示例#2
0
char*	id_strdup(char* str)
{
	char*	ret;
	int	len;

	if (str == NULL)
		return (str);
	len = id_strlen(str);
	ret = calloc(len + 1, sizeof(*ret));
	if (ret == NULL)
		return (0);
	ret = id_strcpy(ret, str);
	return (ret);
}