summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1ec666b)
raw | patch | inline | side by side (parent: 1ec666b)
author | Johan Herland <johan@herland.net> | |
Sat, 13 Feb 2010 21:28:15 +0000 (22:28 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 14 Feb 2010 03:36:12 +0000 (19:36 -0800) |
Created by a simple cleanup and rename of lookup_notes().
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes.c | patch | blob | history | |
notes.h | patch | blob | history |
index 2e82d719877142dcdaf447544ba856842757ff65..a0a85b4dafe91481c06985b3faffd8c7d964d051 100644 (file)
--- a/notes.c
+++ b/notes.c
return note_tree_remove(&root_node, 0, &l);
}
-static unsigned char *lookup_notes(const unsigned char *object_sha1)
+const unsigned char *get_note(const unsigned char *object_sha1)
{
- struct leaf_node *found = note_tree_find(&root_node, 0, object_sha1);
- if (found)
- return found->val_sha1;
- return NULL;
+ struct leaf_node *found;
+
+ assert(initialized);
+ found = note_tree_find(&root_node, 0, object_sha1);
+ return found ? found->val_sha1 : NULL;
}
void free_notes(void)
const char *output_encoding, int flags)
{
static const char utf8[] = "utf-8";
- unsigned char *sha1;
+ const unsigned char *sha1;
char *msg, *msg_p;
unsigned long linelen, msglen;
enum object_type type;
if (!initialized)
init_notes(NULL, 0);
- sha1 = lookup_notes(object_sha1);
+ sha1 = get_note(object_sha1);
if (!sha1)
return;
index 9e66855222a1df55aa50122ea21652369c044fd4..0041aecae02e131bfc249ffa40ec702c865e8b45 100644 (file)
--- a/notes.h
+++ b/notes.h
/* Remove the given note object from the internal notes tree structure */
void remove_note(const unsigned char *object_sha1);
+/*
+ * Get the note object SHA1 containing the note data for the given object
+ *
+ * Return NULL if the given object has no notes.
+ */
+const unsigned char *get_note(const unsigned char *object_sha1);
+
/* Free (and de-initialize) the internal notes tree structure */
void free_notes(void);