mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Merge branch 'stable-2.0'
Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c
This commit is contained in:
commit
475772ea57
104 changed files with 3619 additions and 2811 deletions
|
@ -1,4 +1,5 @@
|
|||
/* Copyright (C) 1994-1998, 2000-2011, 2013 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1994-1998, 2000-2011, 2013, 2014 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 3 of
|
||||
|
@ -45,9 +46,7 @@
|
|||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h> /* for X_OK define */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
|
@ -220,6 +219,21 @@ script_get_backslash (FILE *f)
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
/*
|
||||
* Like `realloc', but free memory on failure;
|
||||
* unlike `scm_realloc', return NULL, not aborts.
|
||||
*/
|
||||
static void*
|
||||
realloc0 (void *ptr, size_t size)
|
||||
{
|
||||
void *new_ptr = realloc (ptr, size);
|
||||
if (!new_ptr)
|
||||
{
|
||||
free (ptr);
|
||||
}
|
||||
return new_ptr;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
script_read_arg (FILE *f)
|
||||
|
@ -245,7 +259,7 @@ script_read_arg (FILE *f)
|
|||
if (len >= size)
|
||||
{
|
||||
size = (size + 1) * 2;
|
||||
buf = realloc (buf, size);
|
||||
buf = realloc0 (buf, size);
|
||||
if (! buf)
|
||||
return 0;
|
||||
}
|
||||
|
@ -328,9 +342,9 @@ scm_get_meta_args (int argc, char **argv)
|
|||
found_args:
|
||||
/* FIXME: we leak the result of calling script_read_arg. */
|
||||
while ((narg = script_read_arg (f)))
|
||||
if (!(nargv = (char **) realloc (nargv,
|
||||
if (!(nargv = (char **) realloc0 (nargv,
|
||||
(1 + ++nargc) * sizeof (char *))))
|
||||
return 0L;
|
||||
return 0L;
|
||||
else
|
||||
nargv[nargi++] = narg;
|
||||
fclose (f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue