fts-compat.c (8a507b98ab8d7f882e4c691ebfa4e84d6651f9d1) fts-compat.c (e8420087b0ae4a2d0611cd2f6413d150cfc83554)
1/* $OpenBSD: fts.c,v 1.9 1997/08/02 00:13:49 millert Exp $ */
2
3/*-
4 * Copyright (c) 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 867 unchanged lines hidden (view full) ---

876 * Construct an array of pointers to the structures and call qsort(3).
877 * Reassemble the array in the order returned by qsort. If unable to
878 * sort for memory reasons, return the directory entries in their
879 * current order. Allocate enough space for the current needs plus
880 * 40 so don't realloc one entry at a time.
881 */
882 if (nitems > sp->fts_nitems) {
883 sp->fts_nitems = nitems + 40;
1/* $OpenBSD: fts.c,v 1.9 1997/08/02 00:13:49 millert Exp $ */
2
3/*-
4 * Copyright (c) 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 867 unchanged lines hidden (view full) ---

876 * Construct an array of pointers to the structures and call qsort(3).
877 * Reassemble the array in the order returned by qsort. If unable to
878 * sort for memory reasons, return the directory entries in their
879 * current order. Allocate enough space for the current needs plus
880 * 40 so don't realloc one entry at a time.
881 */
882 if (nitems > sp->fts_nitems) {
883 sp->fts_nitems = nitems + 40;
884 if ((sp->fts_array = realloc(sp->fts_array,
884 if ((sp->fts_array = reallocf(sp->fts_array,
885 (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
886 sp->fts_nitems = 0;
887 return (head);
888 }
889 }
890 for (ap = sp->fts_array, p = head; p; p = p->fts_link)
891 *ap++ = p;
892 qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);

--- 61 unchanged lines hidden (view full) ---

954 * plus 256 bytes so don't realloc the path 2 bytes at a time.
955 */
956static int
957fts_palloc(sp, more)
958 FTS *sp;
959 size_t more;
960{
961 sp->fts_pathlen += more + 256;
885 (size_t)(sp->fts_nitems * sizeof(FTSENT *)))) == NULL) {
886 sp->fts_nitems = 0;
887 return (head);
888 }
889 }
890 for (ap = sp->fts_array, p = head; p; p = p->fts_link)
891 *ap++ = p;
892 qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);

--- 61 unchanged lines hidden (view full) ---

954 * plus 256 bytes so don't realloc the path 2 bytes at a time.
955 */
956static int
957fts_palloc(sp, more)
958 FTS *sp;
959 size_t more;
960{
961 sp->fts_pathlen += more + 256;
962 sp->fts_path = realloc(sp->fts_path, (size_t)sp->fts_pathlen);
962 sp->fts_path = reallocf(sp->fts_path, (size_t)sp->fts_pathlen);
963 return (sp->fts_path == NULL);
964}
965
966/*
967 * When the path is realloc'd, have to fix all of the pointers in structures
968 * already returned.
969 */
970static void

--- 70 unchanged lines hidden ---
963 return (sp->fts_path == NULL);
964}
965
966/*
967 * When the path is realloc'd, have to fix all of the pointers in structures
968 * already returned.
969 */
970static void

--- 70 unchanged lines hidden ---