(size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
sp->fts_nitems * sizeof(FTSENT *))) == NULL) {
fts_sort(sp, head, nitems)	FTS *sp;	FTSENT *head;	register int nitems;{	register FTSENT **ap, *p;	/*	 * Construct an array of pointers to the structures and call qsort(3).	 * Reassemble the array in the order returned by qsort.  If unable to	 * sort for memory reasons, return the directory entries in their	 * current order.  Allocate enough space for the current needs plus	 * 40 so don't realloc one entry at a time.	 */	if (nitems > sp->fts_nitems) {		struct _ftsent **a;		sp->fts_nitems = nitems + 40;		if ((a = realloc(sp->fts_array,		    (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {			if (sp->fts_array)				free(sp->fts_array);			sp->fts_array = NULL;			sp->fts_nitems = 0;			return (head);		}		sp->fts_array = a;	}	for (ap = sp->fts_array, p = head; p; p = p->fts_link)		*ap++ = p;	qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);	for (head = *(ap = sp->fts_array); --nitems; ++ap)		ap[0]->fts_link = ap[1];	ap[0]->fts_link = NULL;	return (head);}