From 4c2093d430fae79d54d618685d9b0092f6acaadb Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 10 Nov 2023 05:06:21 +0900 Subject: [PATCH] Replace last C use of get_note_hg with an adhoc function --- src/hg-data.c | 3 +-- src/hg-data.h | 3 +-- src/libcinnabar.rs | 6 ++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hg-data.c b/src/hg-data.c index e45631a54..f9faf5d59 100644 --- a/src/hg-data.c +++ b/src/hg-data.c @@ -53,8 +53,7 @@ void hg_file_load(struct hg_file *result, const struct hg_object_id *oid) if (is_empty_hg_file(oid)) return; - ensure_notes(&files_meta); - note = get_note_hg(&files_meta, oid); + note = get_files_meta(oid); if (note) { if (oid_object_info_extended( the_repository, note, &oi, diff --git a/src/hg-data.h b/src/hg-data.h index 13128e990..7361be44b 100644 --- a/src/hg-data.h +++ b/src/hg-data.h @@ -91,7 +91,6 @@ void hg_file_store(struct hg_file *file, struct hg_file *reference); int add_hg2git(const struct hg_object_id *oid, const struct object_id *note_oid); int add_files_meta(const struct hg_object_id *oid, const struct object_id *note_oid); -const struct object_id *get_note_hg(struct notes_tree *notes, - const struct hg_object_id *oid); +const struct object_id *get_files_meta(const struct hg_object_id *oid); #endif diff --git a/src/libcinnabar.rs b/src/libcinnabar.rs index 387dca433..2fa8bcf99 100644 --- a/src/libcinnabar.rs +++ b/src/libcinnabar.rs @@ -183,6 +183,12 @@ pub unsafe extern "C" fn get_note_hg( cinnabar_get_note(notes, &git_oid.into()) } +#[no_mangle] +pub unsafe extern "C" fn get_files_meta(oid: *const hg_object_id) -> *const object_id { + ensure_notes(&mut files_meta.0); + get_note_hg(&mut files_meta.0, oid) +} + unsafe fn add_note_hg( notes: *mut cinnabar_notes_tree, oid: *const hg_object_id,