1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-24 13:30:21 +02:00

Fix stylistic issues revealed by "make syntax-check".

* libguile/gc-malloc.c (scm_must_free): Remove unnecessary `if' before
  `free ()'.

* libguile/stime.c (scm_localtime, scm_mktime): Likewise.

* libguile/eval.i.c (ceval): Don't cast the result of alloca(3).

* libguile/i18n.c (SCM_STRING_TO_U32_BUF): Likewise.

* test-suite/standalone/test-unwind.c: Likewise.

* libguile/strings.c (scm_i_deprecated_string_chars): Don't end error
  message in period.
This commit is contained in:
Ludovic Courtès 2009-11-17 23:07:10 +01:00
parent c84bdaf6b4
commit c291b58835
6 changed files with 15 additions and 23 deletions

View file

@ -221,8 +221,7 @@ CEVAL (SCM x, SCM env)
* *
* Even frames are eval frames, odd frames are apply frames. * Even frames are eval frames, odd frames are apply frames.
*/ */
debug.vect = (scm_t_debug_info *) alloca (scm_debug_eframe_size debug.vect = alloca (scm_debug_eframe_size * sizeof (scm_t_debug_info));
* sizeof (scm_t_debug_info));
debug.info = debug.vect; debug.info = debug.vect;
debug_info_end = debug.vect + scm_debug_eframe_size; debug_info_end = debug.vect + scm_debug_eframe_size;
scm_i_set_last_debug_frame (&debug); scm_i_set_last_debug_frame (&debug);

View file

@ -322,13 +322,8 @@ scm_must_free (void *obj)
#ifdef GUILE_DEBUG_MALLOC #ifdef GUILE_DEBUG_MALLOC
scm_malloc_unregister (obj); scm_malloc_unregister (obj);
#endif #endif
if (obj)
free (obj); free (obj);
else
{
fprintf (stderr,"freeing NULL pointer");
abort ();
}
} }
#undef FUNC_NAME #undef FUNC_NAME

View file

@ -735,7 +735,7 @@ SCM_DEFINE (scm_locale_p, "locale?", 1, 0, 0,
const char *buf = scm_i_string_chars (s1); \ const char *buf = scm_i_string_chars (s1); \
\ \
len = scm_i_string_length (s1); \ len = scm_i_string_length (s1); \
c_s1 = (scm_t_wchar *) alloca (sizeof (scm_t_wchar) * (len + 1)); \ c_s1 = alloca (sizeof (scm_t_wchar) * (len + 1)); \
\ \
for (i = 0; i < len; i ++) \ for (i = 0; i < len; i ++) \
c_s1[i] = (unsigned char ) buf[i]; \ c_s1[i] = (unsigned char ) buf[i]; \

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. /* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -423,8 +423,8 @@ SCM_DEFINE (scm_localtime, "localtime", 1, 1, 0,
result = filltime (&lt, zoff, zname); result = filltime (&lt, zoff, zname);
SCM_CRITICAL_SECTION_END; SCM_CRITICAL_SECTION_END;
if (zname)
free (zname); free (zname);
return result; return result;
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -581,8 +581,7 @@ SCM_DEFINE (scm_mktime, "mktime", 1, 1, 0,
result = scm_cons (scm_from_long (itime), result = scm_cons (scm_from_long (itime),
filltime (&lt, zoff, zname)); filltime (&lt, zoff, zname));
if (zname) free (zname);
free (zname);
scm_dynwind_end (); scm_dynwind_end ();
return result; return result;

View file

@ -1834,7 +1834,7 @@ scm_i_deprecated_string_chars (SCM str)
*/ */
if (IS_SH_STRING (str)) if (IS_SH_STRING (str))
scm_misc_error (NULL, scm_misc_error (NULL,
"SCM_STRING_CHARS does not work with shared substrings.", "SCM_STRING_CHARS does not work with shared substrings",
SCM_EOL); SCM_EOL);
/* We explicitly test for read-only strings to produce a better /* We explicitly test for read-only strings to produce a better
@ -1843,7 +1843,7 @@ scm_i_deprecated_string_chars (SCM str)
if (IS_RO_STRING (str)) if (IS_RO_STRING (str))
scm_misc_error (NULL, scm_misc_error (NULL,
"SCM_STRING_CHARS does not work with read-only strings.", "SCM_STRING_CHARS does not work with read-only strings",
SCM_EOL); SCM_EOL);
/* The following is still wrong, of course... /* The following is still wrong, of course...

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc. /* Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -206,8 +206,7 @@ check_ports ()
if (tmpdir == NULL) if (tmpdir == NULL)
tmpdir = "/tmp"; tmpdir = "/tmp";
filename = (char *) alloca (strlen (tmpdir) + filename = alloca (strlen (tmpdir) + sizeof (FILENAME_TEMPLATE) + 1);
sizeof (FILENAME_TEMPLATE) + 1);
strcpy (filename, tmpdir); strcpy (filename, tmpdir);
strcat (filename, FILENAME_TEMPLATE); strcat (filename, FILENAME_TEMPLATE);