bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

syntax-check hits on gnulib itself


From: Simon Josefsson
Subject: syntax-check hits on gnulib itself
Date: Wed, 03 Sep 2008 16:46:59 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

I ran 'make syntax-check' (from gnulib's maint.mk) and it detected some
problems in code in gnulib itself, see:

./gl/error.c:152:           wmessage = (wchar_t *) alloca (len * sizeof 
(wchar_t));
./gl/vasnprintf.c:1482: buf = (TCHAR_T *) alloca (buf_neededlength * sizeof 
(TCHAR_T));
maint.mk: don't cast alloca return value
make: *** [sc_cast_of_alloca_return_value] Error 1

Any objections to this patch?

/Simon

diff --git a/lib/error.c b/lib/error.c
index 3177bd5..d0ded79 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
@@ -149,7 +149,7 @@ error_tail (int status, int errnum, const char *message, 
va_list args)
       while (1)
        {
          if (__libc_use_alloca (len * sizeof (wchar_t)))
-           wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
+           wmessage = alloca (len * sizeof (wchar_t));
          else
            {
              if (!use_malloc)
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 4ddf45f..f7e104a 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -1479,7 +1479,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #if HAVE_ALLOCA
     if (buf_neededlength < 4000 / sizeof (TCHAR_T))
       {
-       buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T));
+       buf = alloca (buf_neededlength * sizeof (TCHAR_T));
        buf_malloced = NULL;
       }
     else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]