1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 18:56:39 +02:00

(ASSIGN_STRDUPA): New macro (moved here from remove.c).

This commit is contained in:
Jim Meyering
2000-07-23 10:49:59 +00:00
parent 2eb0dc10c3
commit 418ae892b1

View File

@@ -526,3 +526,18 @@ char *base_name PARAMS ((char const *));
#ifndef ATTRIBUTE_UNUSED
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
#if defined strdupa
# 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_ = (char *) alloca (len_); \
DEST = memcpy (tmp_dest_, (s_), len_); \
} \
while (0)
#endif