qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v4 05/25] replay: internal functions for rep


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC PATCH v4 05/25] replay: internal functions for replay log
Date: Fri, 07 Nov 2014 16:01:19 +0000

Pavel Dovgalyuk <address@hidden> writes:

> This patch adds functions to perform read and write operations
> with replay log.
>
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
<snip>
> +
> +/* File for replay writing */
> +FILE *replay_file;
> +
> +void replay_put_byte(unsigned char byte)
> +{
> +    if (replay_file) {
> +        fwrite(&byte, sizeof(byte), 1, replay_file);
> +    }
> +}
> +
> +void replay_put_event(unsigned char event)
> +{
> +    replay_put_byte(event);
> +}
> +
> +
<snip>
> +void replay_put_dword(unsigned int dword)
> +{
> +    if (replay_file) {
> +        fwrite(&dword, sizeof(dword), 1, replay_file);
> +    }
> +}

Given you use the unambiguous types bellow shouldn't you use uint8_t and
uint32_t here to be safe?

<snip>
> +
> +unsigned char replay_get_byte(void)
> +{
> +    unsigned char byte;
> +    if (replay_file) {
> +        fread(&byte, sizeof(byte), 1, replay_file);
> +    }
> +    return byte;
> +}
> +
> +uint16_t replay_get_word(void)
> +{
> +    uint16_t word;
> +    if (replay_file) {
> +        fread(&word, sizeof(word), 1, replay_file);
> +    }
> +
> +    return word;
> +}
> +
> +unsigned int replay_get_dword(void)
> +{
> +    unsigned int dword;
> +    if (replay_file) {
> +        fread(&dword, sizeof(dword), 1, replay_file);
> +    }
> +
> +    return dword;
> +}

Ditto for the fetchers
<snip>

-- 
Alex Bennée



reply via email to

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