diff options
-rw-r--r-- | build-id.c | 6 | ||||
-rw-r--r-- | build-id.h | 4 | ||||
-rw-r--r-- | so-test.c | 6 | ||||
-rw-r--r-- | test.c | 6 |
4 files changed, 7 insertions, 15 deletions
@@ -100,8 +100,8 @@ build_id_length(const struct note *note) return note->nhdr.n_descsz; } -void -build_id_read(const struct note *note, unsigned char *build_id) +const uint8_t * +build_id_data(const struct note *note) { - memcpy(build_id, note->build_id, note->nhdr.n_descsz); + return note->build_id; } @@ -33,5 +33,5 @@ build_id_find_nhdr(const char *name); ElfW(Word) build_id_length(const struct note *note); -void -build_id_read(const struct note *note, unsigned char *build_id); +const uint8_t * +build_id_data(const struct note *note); @@ -36,11 +36,7 @@ main(int argc, char *argv[]) ElfW(Word) len = build_id_length(note); - unsigned char *build_id = malloc(len * sizeof(char)); - if (!build_id) - return -1; - - build_id_read(note, build_id); + const uint8_t *build_id = build_id_data(note); printf("Build ID: "); for (ElfW(Word) i = 0; i < len; i++) { @@ -36,11 +36,7 @@ main(int argc, char *argv[]) ElfW(Word) len = build_id_length(note); - unsigned char *build_id = malloc(len * sizeof(char)); - if (!build_id) - return -1; - - build_id_read(note, build_id); + const uint8_t *build_id = build_id_data(note); printf("Build ID: "); for (ElfW(Word) i = 0; i < len; i++) { |