util/build-id: Return a pointer rather than copying the data

We're about to use the build-id as the starting point for another SHA1
hash in the Intel Vulkan driver, and returning a pointer is far more
convenient.

Reviewed-by: Chad Versace <chadversary@chromium.org>
This commit is contained in:
Jason Ekstrand
2017-02-24 16:29:26 -08:00
parent e3d33a23e6
commit e647c4fbd9
3 changed files with 6 additions and 8 deletions

View File

@@ -63,7 +63,7 @@ anv_device_get_cache_uuid(void *uuid)
if (len < VK_UUID_SIZE) if (len < VK_UUID_SIZE)
return false; return false;
build_id_read(note, uuid, VK_UUID_SIZE); memcpy(uuid, build_id_data(note), VK_UUID_SIZE);
return true; return true;
} }

View File

@@ -107,11 +107,10 @@ build_id_length(const struct build_id_note *note)
return note->nhdr.n_descsz; return note->nhdr.n_descsz;
} }
void const uint8_t *
build_id_read(const struct build_id_note *note, build_id_data(const struct build_id_note *note)
unsigned char *build_id, size_t n)
{ {
memcpy(build_id, note->build_id, n); return note->build_id;
} }
#endif #endif

View File

@@ -31,8 +31,7 @@ build_id_find_nhdr(const char *filename);
unsigned unsigned
build_id_length(const struct build_id_note *note); build_id_length(const struct build_id_note *note);
void const uint8_t *
build_id_read(const struct build_id_note *note, build_id_data(const struct build_id_note *note);
unsigned char *build_id, size_t n);
#endif #endif