Beispiel #1
0
char*	id_strndup(char* str, unsigned int size)
{
	char*		str_cpy;

	str_cpy = calloc(size + 1, sizeof(*str_cpy));
	if (str_cpy == NULL)
		return (0);
	str_cpy = id_strncpy(str_cpy, str, size);
	return (str_cpy);
}
Beispiel #2
0
char*	id_strndup(char* str, unsigned int size)
{
	char*	ret;

	if (str == NULL)
		return (NULL);
	ret = calloc(size + 1, sizeof(*ret));
	if (ret == NULL)
		return (0);
	ret = id_strncpy(ret, str, size);
	return (ret);
}
int	add_word_char(char* str, char** tab, int* i, char* charset)
{
	int	index;

	index = 0;
	while (str[index] && !is_sep_char(str[index], charset))
		index = index + 1;
	*tab = calloc(index + 1, sizeof(**tab));
	if (!*tab)
		return (1);
	*tab = id_strncpy(*tab, str, index);
	*i = *i + index;
	return (0);
}