spell_read_tree(
    FILE	*fd,
    char_u	**bytsp,
    long	*bytsp_len,
    idx_T	**idxsp,
    int		prefixtree,	// TRUE for the prefix tree
    int		prefixcnt)	// when "prefixtree" is TRUE: prefix count
{
    long	len;
    int		idx;
    char_u	*bp;
    idx_T	*ip;

    // The tree size was computed when writing the file, so that we can
    // allocate it as one long block. <nodecount>
    len = get4c(fd);
    if (len < 0)
	return SP_TRUNCERROR;
    if (len >= LONG_MAX / (long)sizeof(int))
	// Invalid length, multiply with sizeof(int) would overflow.
	return SP_FORMERROR;
    if (len > 0)
    {
	// Allocate the byte array.
	bp = alloc(len);
	if (bp == NULL)
	    return SP_OTHERERROR;
	*bytsp = bp;
	if (bytsp_len != NULL)
	    *bytsp_len = len;

	// Allocate the index array.
	ip = lalloc_clear(len * sizeof(int), TRUE);
	if (ip == NULL)
	    return SP_OTHERERROR;
	*idxsp = ip;

	// Recursively read the tree and store it in the array.
	idx = read_tree_node(fd, bp, ip, len, 0, prefixtree, prefixcnt);
	if (idx < 0)
	    return idx;
    }
    return 0;
}
spell_read_tree(
    FILE	*fd,
    char_u	**bytsp,
    long	*bytsp_len,
    idx_T	**idxsp,
    int		prefixtree,	 
    int		prefixcnt)	 
{
    long	len;
    int		idx;
    char_u	*bp;
    idx_T	*ip;

     
     
    len = get4c(fd);
    if (len < 0)
	return SP_TRUNCERROR;
    if (len >= LONG_MAX / (long)sizeof(int))
	 
	return SP_FORMERROR;
    if (len > 0)
    {
	 
	bp = alloc(len);
	if (bp == NULL)
	    return SP_OTHERERROR;
	*bytsp = bp;
	if (bytsp_len != NULL)
	    *bytsp_len = len;

	 
	ip = lalloc_clear(len * sizeof(int), TRUE);
	if (ip == NULL)
	    return SP_OTHERERROR;
	*idxsp = ip;

	 
	idx = read_tree_node(fd, bp, ip, len, 0, prefixtree, prefixcnt);
	if (idx < 0)
	    return idx;
    }
    return 0;
}