From ef8eed28d34c7dcb0366800389b385ba1f288c0f Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Fri, 24 Nov 2017 22:51:05 -0800 Subject: Rename "note" to "build_id_note" to avoid potential collisions --- build-id.c | 18 +++++++++--------- build-id.h | 8 ++++---- so-test.c | 2 +- test.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build-id.c b/build-id.c index 05ff5e5..095a4ad 100644 --- a/build-id.c +++ b/build-id.c @@ -31,7 +31,7 @@ #define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1)) -struct note { +struct build_id_note { ElfW(Nhdr) nhdr; char name[4]; @@ -40,7 +40,7 @@ struct note { struct callback_data { const char *name; - struct note *note; + struct build_id_note *note; }; static int @@ -55,11 +55,11 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_) if (info->dlpi_phdr[i].p_type != PT_NOTE) continue; - struct note *note = (void *)(info->dlpi_addr + - info->dlpi_phdr[i].p_vaddr); + struct build_id_note *note = (void *)(info->dlpi_addr + + info->dlpi_phdr[i].p_vaddr); ptrdiff_t len = info->dlpi_phdr[i].p_filesz; - while (len >= sizeof(struct note)) { + while (len >= sizeof(struct build_id_note)) { if (note->nhdr.n_type == NT_GNU_BUILD_ID && note->nhdr.n_descsz != 0 && note->nhdr.n_namesz == 4 && @@ -71,7 +71,7 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_) size_t offset = sizeof(ElfW(Nhdr)) + ALIGN(note->nhdr.n_namesz, 4) + ALIGN(note->nhdr.n_descsz, 4); - note = (struct note *)((char *)note + offset); + note = (struct build_id_note *)((char *)note + offset); len -= offset; } } @@ -79,7 +79,7 @@ build_id_find_nhdr_callback(struct dl_phdr_info *info, size_t size, void *data_) return 0; } -const struct note * +const struct build_id_note * build_id_find_nhdr(const char *name) { struct callback_data data = { @@ -95,13 +95,13 @@ build_id_find_nhdr(const char *name) } ElfW(Word) -build_id_length(const struct note *note) +build_id_length(const struct build_id_note *note) { return note->nhdr.n_descsz; } const uint8_t * -build_id_data(const struct note *note) +build_id_data(const struct build_id_note *note) { return note->build_id; } diff --git a/build-id.h b/build-id.h index ebe5a2e..6828875 100644 --- a/build-id.h +++ b/build-id.h @@ -25,13 +25,13 @@ #define _GNU_SOURCE #include -struct note; +struct build_id_note; -const struct note * +const struct build_id_note * build_id_find_nhdr(const char *name); ElfW(Word) -build_id_length(const struct note *note); +build_id_length(const struct build_id_note *note); const uint8_t * -build_id_data(const struct note *note); +build_id_data(const struct build_id_note *note); diff --git a/so-test.c b/so-test.c index 44f4563..fb24a4d 100644 --- a/so-test.c +++ b/so-test.c @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) { - const struct note *note = build_id_find_nhdr("./libbuild-id.so"); + const struct build_id_note *note = build_id_find_nhdr("./libbuild-id.so"); if (!note) return -1; diff --git a/test.c b/test.c index d779be8..40d8a51 100644 --- a/test.c +++ b/test.c @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) { - const struct note *note = build_id_find_nhdr(""); + const struct build_id_note *note = build_id_find_nhdr(""); if (!note) return -1; -- cgit v1.2.3