savedir.c (53469) | savedir.c (56230) |
---|---|
1/* savedir.c -- save the list of files in a directory in a string | 1/* savedir.c -- save the list of files in a directory in a string |
2 Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc. | 2 Copyright (C) 1990, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. |
3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of --- 73 unchanged lines hidden (view full) --- 84 struct dirent *dp; 85 char *name_space; 86 char *namep; 87 88 dirp = opendir (dir); 89 if (dirp == NULL) 90 return NULL; 91 | 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of --- 73 unchanged lines hidden (view full) --- 84 struct dirent *dp; 85 char *name_space; 86 char *namep; 87 88 dirp = opendir (dir); 89 if (dirp == NULL) 90 return NULL; 91 |
92 /* Be sure name_size is at least `1' so there's room for 93 the final NUL byte. */ 94 name_size += !name_size; 95 |
|
92 name_space = (char *) malloc (name_size); 93 if (name_space == NULL) 94 { 95 closedir (dirp); 96 return NULL; 97 } 98 namep = name_space; 99 --- 36 unchanged lines hidden --- | 96 name_space = (char *) malloc (name_size); 97 if (name_space == NULL) 98 { 99 closedir (dirp); 100 return NULL; 101 } 102 namep = name_space; 103 --- 36 unchanged lines hidden --- |