[Mesa-dev] [PATCH 08/11] compiler/blob: Make some parameters void instead of uint8_t

Jason Ekstrand jason at jlekstrand.net
Fri Oct 13 04:08:41 UTC 2017


On Wed, Oct 11, 2017 at 11:26 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:

> I've sent some minor comments on patches #3, #5, and #6. Also, spot the
> typo in the title of patch #4 :)
>
> With those addressed, patches 1-8 are:
>
> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
>

Thanks!


> On 11.10.2017 22:38, Jason Ekstrand wrote:
>
>> There are certain advantages to using uint8_t internally such as
>> well-defined arithmetic on all platforms.  However, interfaces that
>> work in terms of raw data should use a void* type.
>> ---
>>   src/compiler/blob.c | 6 +++---
>>   src/compiler/blob.h | 4 ++--
>>   2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/compiler/blob.c b/src/compiler/blob.c
>> index 4ebe94b..f523423 100644
>> --- a/src/compiler/blob.c
>> +++ b/src/compiler/blob.c
>> @@ -236,7 +236,7 @@ blob_write_string(struct blob *blob, const char *str)
>>   }
>>     void
>> -blob_reader_init(struct blob_reader *blob, const uint8_t *data, size_t
>> size)
>> +blob_reader_init(struct blob_reader *blob, const void *data, size_t size)
>>   {
>>      blob->data = data;
>>      blob->end = blob->data + size;
>> @@ -278,9 +278,9 @@ blob_read_bytes(struct blob_reader *blob, size_t size)
>>   }
>>     void
>> -blob_copy_bytes(struct blob_reader *blob, uint8_t *dest, size_t size)
>> +blob_copy_bytes(struct blob_reader *blob, void *dest, size_t size)
>>   {
>> -   const uint8_t *bytes;
>> +   const void *bytes;
>>        bytes = blob_read_bytes(blob, size);
>>      if (bytes == NULL)
>> diff --git a/src/compiler/blob.h b/src/compiler/blob.h
>> index 547d49b..71ffcfe 100644
>> --- a/src/compiler/blob.h
>> +++ b/src/compiler/blob.h
>> @@ -269,7 +269,7 @@ blob_write_string(struct blob *blob, const char *str);
>>    * current value is unchanged before and after the call.
>>    */
>>   void
>> -blob_reader_init(struct blob_reader *blob, const uint8_t *data, size_t
>> size);
>> +blob_reader_init(struct blob_reader *blob, const void *data, size_t
>> size);
>>     /**
>>    * Read some unstructured, fixed-size data from the current location,
>> (and
>> @@ -289,7 +289,7 @@ blob_read_bytes(struct blob_reader *blob, size_t
>> size);
>>    * it to \dest (and update the current location to just past this data)
>>    */
>>   void
>> -blob_copy_bytes(struct blob_reader *blob, uint8_t *dest, size_t size);
>> +blob_copy_bytes(struct blob_reader *blob, void *dest, size_t size);
>>     /**
>>    * Read a uint32_t from the current location, (and update the current
>> location
>>
>>
>
> --
> Lerne, wie die Welt wirklich ist,
> Aber vergiss niemals, wie sie sein sollte.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171012/3f8eceb7/attachment.html>


More information about the mesa-dev mailing list