Modified for systems where realloc() doesn't cope with nul pointers.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@2599 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1997-10-31 12:51:03 +00:00
parent 4d4e8eafce
commit ee8e30f158

View file

@ -137,14 +137,20 @@ void get_arguments (int argc, char** argv)
for (i = 0; i < argc; i++) {
if (!strncmp (argv[i], "-l", 2)) {
all_libraries = realloc (all_libraries,
if (all_libraries)
all_libraries = realloc (all_libraries,
(libraries_no + 1) * sizeof (char*));
else
all_libraries = malloc ((libraries_no + 1) * sizeof (char*));
all_libraries[libraries_no] = malloc (strlen (argv[i]) - 1);
strcpy (all_libraries[libraries_no], argv[i] + 2);
libraries_no++;
}
else if (!strncmp (argv[i], "-L", 2)) {
library_paths = realloc (library_paths, (paths_no + 1) * sizeof (char*));
if (library_paths)
library_paths = realloc (library_paths, (paths_no + 1) * sizeof(char*));
else
library_paths = malloc ((paths_no + 1) * sizeof(char*));
library_paths[paths_no] = malloc (strlen (argv[i]) - 1);
strcpy (library_paths[paths_no], argv[i] + 2);
paths_no++;