All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philip Oakley" <philipoakley@iee.org>
To: "Alberto" <albcoron@gmail.com>, <git@vger.kernel.org>
Subject: Re: [PATCH] Replace memcpy with hashcpy when lengths defined
Date: Sun, 2 Mar 2014 19:44:13 -0000	[thread overview]
Message-ID: <BD20EE393DBA43E39E6390ECB511EDD2@PhilipOakley> (raw)
In-Reply-To: 1393787977-13164-1-git-send-email-albcoron@gmail.com

From: "Alberto" <albcoron@gmail.com>
> From: Alberto Corona <albcoron@gmail.com>
>
> Replaced memcpy with hashcpy where lengts in memcpy

s/lengts/lengths/

> are already defined.
>
> Signed-off-by: Alberto Corona <albcoron@gmail.com>
> ---
> bundle.c    | 2 +-
> grep.c      | 2 +-
> refs.c      | 2 +-
> sha1_name.c | 4 ++--
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/bundle.c b/bundle.c
> index e99065c..7809fbb 100644
> --- a/bundle.c
> +++ b/bundle.c
> @@ -19,7 +19,7 @@ static void add_to_ref_list(const unsigned char 
> *sha1, const char *name,
>  list->list = xrealloc(list->list,
>  list->alloc * sizeof(list->list[0]));
>  }
> - memcpy(list->list[list->nr].sha1, sha1, 20);
> + hashcpy(list->list[list->nr].sha1, sha1);
>  list->list[list->nr].name = xstrdup(name);
>  list->nr++;
> }
> diff --git a/grep.c b/grep.c
> index c668034..f5101f7 100644
> --- a/grep.c
> +++ b/grep.c
> @@ -1650,7 +1650,7 @@ void grep_source_init(struct grep_source *gs, 
> enum grep_source_type type,
>  break;
>  case GREP_SOURCE_SHA1:
>  gs->identifier = xmalloc(20);
> - memcpy(gs->identifier, identifier, 20);
> + hashcpy(gs->identifier, identifier);
>  break;
>  case GREP_SOURCE_BUF:
>  gs->identifier = NULL;
> diff --git a/refs.c b/refs.c
> index 89228e2..f90b7ea 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1222,7 +1222,7 @@ static int resolve_gitlink_packed_ref(struct 
> ref_cache *refs,
>  if (ref == NULL)
>  return -1;
>
> - memcpy(sha1, ref->u.value.sha1, 20);
> + hashcpy(sha1, ref->u.value.sha1);
>  return 0;
> }
>
> diff --git a/sha1_name.c b/sha1_name.c
> index 6fca869..3f5010f 100644
> --- a/sha1_name.c
> +++ b/sha1_name.c
> @@ -111,7 +111,7 @@ static void find_short_object_filename(int len, 
> const char *hex_pfx, struct disa
>  continue;
>  if (memcmp(de->d_name, hex_pfx + 2, len - 2))
>  continue;
> - memcpy(hex + 2, de->d_name, 38);
> + hashcpy(hex + 2, de->d_name);
>  if (!get_sha1_hex(hex, sha1))
>  update_candidates(ds, sha1);
>  }
> @@ -373,7 +373,7 @@ const char *find_unique_abbrev(const unsigned char 
> *sha1, int len)
>  static char hex[41];
>
>  exists = has_sha1_file(sha1);
> - memcpy(hex, sha1_to_hex(sha1), 40);
> + hashcpy(hex, sha1_to_hex(sha1));
>  if (len == 40 || !len)
>  return hex;
>  while (len < 40) {
> -- 
> 1.9.0.138.g2de3478.dirty
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2014-03-02 19:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 19:19 [PATCH] Replace memcpy with hashcpy when lengths defined Alberto
2014-03-02 19:44 ` Philip Oakley [this message]
2014-03-02 22:39 ` Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BD20EE393DBA43E39E6390ECB511EDD2@PhilipOakley \
    --to=philipoakley@iee.org \
    --cc=albcoron@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.