Skip to content

Commit

Permalink
Replace last C use of get_note_hg with an adhoc function
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Nov 9, 2023
1 parent 62abc8b commit f81c67b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/hg-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/hg-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions src/libcinnabar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ 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 {
get_note_hg(&mut files_meta.0, oid)
}

unsafe fn add_note_hg(
notes: *mut cinnabar_notes_tree,
oid: *const hg_object_id,
Expand Down

0 comments on commit f81c67b

Please sign in to comment.