From: Johan Herland Date: Sat, 13 Feb 2010 21:28:13 +0000 (+0100) Subject: Notes API: add_note(): Add note objects to the internal notes tree structure X-Git-Tag: v1.7.1-rc0~37^2~40 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2626b5367047d8b8d5c4555ec6b579ed37a6625d;p=git.git Notes API: add_note(): Add note objects to the internal notes tree structure Signed-off-by: Johan Herland Signed-off-by: Junio C Hamano --- diff --git a/notes.c b/notes.c index 3f4ae3534..2c0d14ed8 100644 --- a/notes.c +++ b/notes.c @@ -368,6 +368,17 @@ void init_notes(const char *notes_ref, int flags) load_subtree(&root_tree, &root_node, 0); } +void add_note(const unsigned char *object_sha1, const unsigned char *note_sha1) +{ + struct leaf_node *l; + + assert(initialized); + l = (struct leaf_node *) xmalloc(sizeof(struct leaf_node)); + hashcpy(l->key_sha1, object_sha1); + hashcpy(l->val_sha1, note_sha1); + note_tree_insert(&root_node, 0, l, PTR_TYPE_NOTE); +} + static unsigned char *lookup_notes(const unsigned char *object_sha1) { struct leaf_node *found = note_tree_find(&root_node, 0, object_sha1); diff --git a/notes.h b/notes.h index 6b527991b..5f2285217 100644 --- a/notes.h +++ b/notes.h @@ -21,6 +21,10 @@ */ void init_notes(const char *notes_ref, int flags); +/* Add the given note object to the internal notes tree structure */ +void add_note(const unsigned char *object_sha1, + const unsigned char *note_sha1); + /* Free (and de-initialize) the internal notes tree structure */ void free_notes(void);