qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: veroniabahaa@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] util: move declarations out of qemu-common.h
Date: Mon, 21 Mar 2016 18:50:47 +0100	[thread overview]
Message-ID: <56F03477.6090008@redhat.com> (raw)
In-Reply-To: <1458494179-7165-1-git-send-email-veroniabahaa@gmail.com>

There are only two issues with the patch, which I fixed before queuing
it for my next pull request.


On 20/03/2016 18:16, veroniabahaa@gmail.com wrote:
> -/* path.c */
> -void init_paths(const char *prefix);
> -const char *path(const char *pathname);

The first is that only the above two lines were really for path.c, so I
have removed everything else from path.h.  Likewise, unicode.c only has
mod_utf8_codepoint.

> -/* unicode.c */
> -int mod_utf8_codepoint(const char *s, size_t n, char **end);
> -
> -/*
> - * Hexdump a buffer to a file. An optional string prefix is added to every line
> - */
> -
> -void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
> -
>  /* vector definitions */
>  #ifdef __ALTIVEC__
>  #include <altivec.h>
> diff --git a/include/qemu/bcd.h b/include/qemu/bcd.h
> new file mode 100644
> index 0000000..7e720c4
> --- /dev/null
> +++ b/include/qemu/bcd.h
> @@ -0,0 +1,10 @@
> +/* Convert a byte between binary and BCD.  */
> +static inline uint8_t to_bcd(uint8_t val)
> +{
> +    return ((val / 10) << 4) | (val % 10);
> +}
> +
> +static inline uint8_t from_bcd(uint8_t val)
> +{
> +    return ((val >> 4) * 10) + (val & 0x0f);
> +}

The second is that you need multiple-inclusion guards here, like

#ifndef QEMU_BCD_H
#define QEMU_BCD_H 1

/* Convert a byte between binary and BCD.  */
static inline uint8_t to_bcd(uint8_t val)
{
    return ((val / 10) << 4) | (val % 10);
}

static inline uint8_t from_bcd(uint8_t val)
{
    return ((val >> 4) * 10) + (val & 0x0f);
}

#endif

That said, great job, considering that even just creating qemu/bcd.h
would have been enough.  Instead, you went ahead and touched 140 files.
 Thanks!

Paolo

  reply	other threads:[~2016-03-21 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-20 17:16 [Qemu-devel] [PATCH] util: move declarations out of qemu-common.h veroniabahaa
2016-03-21 17:50 ` Paolo Bonzini [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-03-20 14:43 Veronia
2016-03-24  0:17 ` Eric Blake
2016-03-24  0:18   ` Eric Blake

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=56F03477.6090008@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=veroniabahaa@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).