From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johan Herland Subject: [PATCHv13 05/30] Notes API: add_note(): Add note objects to the internal notes tree structure Date: Sat, 13 Feb 2010 22:28:13 +0100 Message-ID: <1266096518-2104-6-git-send-email-johan@herland.net> References: <1266096518-2104-1-git-send-email-johan@herland.net> Mime-Version: 1.0 Content-Type: TEXT/PLAIN Content-Transfer-Encoding: 7BIT Cc: git@vger.kernel.org, johan@herland.net To: gitster@pobox.com X-From: git-owner@vger.kernel.org Sat Feb 13 22:31:56 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NgPam-0002mJ-4E for gcvg-git-2@lo.gmane.org; Sat, 13 Feb 2010 22:31:56 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757583Ab0BMV3T (ORCPT ); Sat, 13 Feb 2010 16:29:19 -0500 Received: from smtp.getmail.no ([84.208.15.66]:51186 "EHLO smtp.getmail.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757963Ab0BMV3C (ORCPT ); Sat, 13 Feb 2010 16:29:02 -0500 Received: from smtp.getmail.no ([10.5.16.4]) by get-mta-out02.get.basefarm.net (Sun Java(tm) System Messaging Server 7.0-0.04 64bit (built Jun 20 2008)) with ESMTP id <0KXS00EEQUCDVE80@get-mta-out02.get.basefarm.net> for git@vger.kernel.org; Sat, 13 Feb 2010 22:29:01 +0100 (MET) Received: from localhost.localdomain ([84.215.68.234]) by get-mta-in01.get.basefarm.net (Sun Java(tm) System Messaging Server 7.0-0.04 64bit (built Jun 20 2008)) with ESMTP id <0KXS00ADYUC2BL00@get-mta-in01.get.basefarm.net> for git@vger.kernel.org; Sat, 13 Feb 2010 22:29:01 +0100 (MET) X-PMX-Version: 5.5.3.366731, Antispam-Engine: 2.7.0.366912, Antispam-Data: 2010.2.13.211545 X-Mailer: git-send-email 1.7.0.rc1.141.gd3fd In-reply-to: <1266096518-2104-1-git-send-email-johan@herland.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Signed-off-by: Johan Herland --- notes.c | 11 +++++++++++ notes.h | 4 ++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/notes.c b/notes.c index 3f4ae35..2c0d14e 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 6b52799..5f22852 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); -- 1.7.0.rc1.141.gd3fd