[Mesa-dev] [PATCH mesa] anv: remove unnecessary runtime copy of static string

Jason Ekstrand jason at jlekstrand.net
Tue Jul 17 18:30:37 UTC 2018


I didn't know that worked.  Neat!

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Tue, Jul 17, 2018 at 9:41 AM Eric Engestrom <eric.engestrom at intel.com>
wrote:

> It's actually also a bit safer, since now the compiler will warn if
> the string is larger than the `.name` array.
>
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
> ---
>  src/intel/vulkan/anv_gem.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c
> index 3ba6d198a8a801427123..c43b5ef9e066f6e0ba24 100644
> --- a/src/intel/vulkan/anv_gem.c
> +++ b/src/intel/vulkan/anv_gem.c
> @@ -444,12 +444,11 @@ struct sync_merge_data {
>  int
>  anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2)
>  {
> -   const char name[] = "anv merge fence";
>     struct sync_merge_data args = {
> +      .name = "anv merge fence",
>        .fd2 = fd2,
>        .fence = -1,
>     };
> -   memcpy(args.name, name, sizeof(name));
>
>     int ret = anv_ioctl(fd1, SYNC_IOC_MERGE, &args);
>     if (ret == -1)
> --
> Cheers,
>   Eric
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180717/acbb79ff/attachment-0001.html>


More information about the mesa-dev mailing list