Mesa (master): util/build-id: Return a pointer rather than copying the data
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Wed Mar 1 23:32:02 UTC 2017
Module: Mesa
Branch: master
Commit: e647c4fbd9a186d9df9d5b0e50507f33180214a8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e647c4fbd9a186d9df9d5b0e50507f33180214a8
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Fri Feb 24 16:29:26 2017 -0800
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 at chromium.org>
---
src/intel/vulkan/anv_device.c | 2 +-
src/util/build_id.c | 7 +++----
src/util/build_id.h | 5 ++---
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 238e149..9b9355c 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -63,7 +63,7 @@ anv_device_get_cache_uuid(void *uuid)
if (len < VK_UUID_SIZE)
return false;
- build_id_read(note, uuid, VK_UUID_SIZE);
+ memcpy(uuid, build_id_data(note), VK_UUID_SIZE);
return true;
}
diff --git a/src/util/build_id.c b/src/util/build_id.c
index cc0f852..c53e71d 100644
--- a/src/util/build_id.c
+++ b/src/util/build_id.c
@@ -107,11 +107,10 @@ build_id_length(const struct build_id_note *note)
return note->nhdr.n_descsz;
}
-void
-build_id_read(const struct build_id_note *note,
- unsigned char *build_id, size_t n)
+const uint8_t *
+build_id_data(const struct build_id_note *note)
{
- memcpy(build_id, note->build_id, n);
+ return note->build_id;
}
#endif
diff --git a/src/util/build_id.h b/src/util/build_id.h
index 39bf9b0..551ac69 100644
--- a/src/util/build_id.h
+++ b/src/util/build_id.h
@@ -31,8 +31,7 @@ build_id_find_nhdr(const char *filename);
unsigned
build_id_length(const struct build_id_note *note);
-void
-build_id_read(const struct build_id_note *note,
- unsigned char *build_id, size_t n);
+const uint8_t *
+build_id_data(const struct build_id_note *note);
#endif
More information about the mesa-commit
mailing list