From 3d56cf5c1db2ca76101b63f0f70c0562eb0a0efd Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 28 Sep 2003 08:23:28 +0000 Subject: [PATCH] Remove unnecessary casts of alloca, since now it's guaranteed to be (void *). --- src/cp.c | 9 ++++----- src/ln.c | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cp.c b/src/cp.c index 9e5e3d7..a3f89e3 100644 --- a/src/cp.c +++ b/src/cp.c @@ -285,7 +285,7 @@ re_protect (const char *const_dst_path, int src_offset, char *src_path; /* The source name in `dst_path'. */ uid_t myeuid = geteuid (); - dst_path = (char *) alloca (strlen (const_dst_path) + 1); + dst_path = alloca (strlen (const_dst_path) + 1); strcpy (dst_path, const_dst_path); src_path = dst_path + src_offset; @@ -383,13 +383,13 @@ make_path_private (const char *const_dirpath, int src_offset, int mode, char *dst_dirname; /* Leading path of `dirpath'. */ size_t dirlen; /* Length of leading path of `dirpath'. */ - dirpath = (char *) alloca (strlen (const_dirpath) + 1); + dirpath = alloca (strlen (const_dirpath) + 1); strcpy (dirpath, const_dirpath); src = dirpath + src_offset; dirlen = dir_len (dirpath); - dst_dirname = (char *) alloca (dirlen + 1); + dst_dirname = alloca (dirlen + 1); memcpy (dst_dirname, dirpath, dirlen); dst_dirname[dirlen] = '\0'; @@ -691,8 +691,7 @@ do_copy (int n_files, char **file, const char *target_directory, char *source_base; ASSIGN_BASENAME_STRDUPA (source_base, source); - new_dest = (char *) alloca (strlen (dest) - + strlen (source_base) + 1); + new_dest = alloca (strlen (dest) + strlen (source_base) + 1); stpcpy (stpcpy (new_dest, dest), source_base); } else diff --git a/src/ln.c b/src/ln.c index 468a19a..d3467a6 100644 --- a/src/ln.c +++ b/src/ln.c @@ -75,12 +75,12 @@ int symlink (); char *tmp_source; \ size_t buf_len = strlen (source) + 1; \ \ - tmp_source = (char *) alloca (buf_len); \ + tmp_source = alloca (buf_len); \ memcpy (tmp_source, (source), buf_len); \ strip_trailing_slashes (tmp_source); \ source_base = base_name (tmp_source); \ \ - (new_dest) = (char *) alloca (strlen ((dest)) + 1 \ + (new_dest) = alloca (strlen ((dest)) + 1 \ + strlen (source_base) + 1); \ stpcpy (stpcpy (stpcpy ((new_dest), (dest)), "/"), source_base);\ } \ @@ -266,7 +266,7 @@ do_link (const char *source, const char *dest) if (tmp_backup == NULL) xalloc_die (); buf_len = strlen (tmp_backup) + 1; - dest_backup = (char *) alloca (buf_len); + dest_backup = alloca (buf_len); memcpy (dest_backup, tmp_backup, buf_len); free (tmp_backup); if (rename (dest, dest_backup)) -- 2.7.4