bug-coreutils
[Top][All Lists]
Advanced

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

Re: system.h cleanups


From: Jim Meyering
Subject: Re: system.h cleanups
Date: Thu, 08 Oct 2009 17:48:58 +0200

Pádraig Brady wrote:
> Jim Meyering wrote:
>> Eric Blake wrote:
>>> >From 3fe95b8d5294df9747982cc6e41a6adb621450a0 Mon Sep 17 00:00:00 2001
>>> From: Eric Blake <address@hidden>
>>> Date: Thu, 8 Oct 2009 08:10:50 -0600
>>> Subject: [PATCH 2/3] maint: remove unused macros and declarations
>>>
>>> * src/system.h (strdupa): Delete unused macro.
>> ...
>>> -# define ASSIGN_STRDUPA(DEST, S)           \
>>> -  do { DEST = strdupa (S); } while (0)
>>> -#else
>>> -# define ASSIGN_STRDUPA(DEST, S)           \
>>> -  do                                               \
>>> -    {                                              \
>>> -      const char *s_ = (S);                        \
>>> -      size_t len_ = strlen (s_) + 1;               \
>>> -      char *tmp_dest_ = alloca (len_);             \
>>> -      DEST = memcpy (tmp_dest_, s_, len_); \
>>> -    }                                              \
>>> -  while (0)
>>> -#endif
>> ...
>>
>> ??  As far as I can see, one cannot remove ASSIGN_STRDUPA,
>> since it is not defined anyplace else.
>> The code (cp.c, df.c, copy.c) won't compile without it.
>
> As a side note removing it will allow reinstating a warning check:
> http://lists.gnu.org/archive/html/bug-coreutils/2009-07/msg00069.html

Perhaps it compiled for Eric because he was building
with some patch that removes all of those uses?

I think I've audited all of those at one time or another.
I haven't been very concerned with the one in copy.c,
because as a comment there probably says, the offending
use will go away with the fts rewrite.  Besides, given
existing PATH_MAX limitations, it's relatively hard to
trigger bad behavior.

All that said, if anyone wants to take the time to
cleanly replace those (no exit, no leaks allowed), please do.




reply via email to

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