Commit 3e89665eb6d5ab75051dc59fc8b63316908b19d1

Shawn O. Pearce 2008-10-31T18:34:02

Scratch the git_revp_attr configuration of a git_revp This isn't the best idea I've head. Pierre Habouzit was suggesting a technique of assigning a unique integer to each commit and then allocating storage out of auxiliary pools, using the commit's unique integer to index into any auxiliary pool in constant time. This way both applications and the library can efficiently attach arbitrary data onto a commit, such as rewritten parents, or flags, and have them disconnected from the main object hash table. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

diff --git a/src/git_commit.h b/src/git_commit.h
index 8c7833b..3864bcd 100644
--- a/src/git_commit.h
+++ b/src/git_commit.h
@@ -78,15 +78,6 @@ GIT_EXTERN(git_commit*) git_commit_parse(git_revp *pool, const git_oid *id);
  */
 GIT_EXTERN(const git_oid*) git_commit_id(git_commit *commit);
 
-/**
- * Get the application data address.
- * @param commit a previously parsed commit.
- * @return address of the application's data buffer.
- *         Applications should cast to something like
- *         'struct mydata*' in order to access fields.
- */
-GIT_EXTERN(void*) git_commit_appdata(git_commit *commit);
-
 /** @} */
 GIT_END_DECL
 #endif
diff --git a/src/git_revwalk.c b/src/git_revwalk.c
index 1088490..898dabc 100644
--- a/src/git_revwalk.c
+++ b/src/git_revwalk.c
@@ -35,33 +35,18 @@
 
 #include "git_revwalk.h"
 #include <stdlib.h>
-#include <string.h>
-
-struct git_revp_attr {
-	size_t app_size;
-	int (*app_init)(git_commit *, void *);
-};
 
 struct git_revp {
 	git_odb *db;
-	git_revp_attr attr;
 };
 
-
-git_revp *git_revp_alloc(
-	git_odb *db,
-	const git_revp_attr *attr)
+git_revp *git_revp_alloc(git_odb *db)
 {
 	git_revp *walk = malloc(sizeof(*walk));
 	if (!walk)
 		return NULL;
 
 	walk->db = db;
-	if (attr)
-		memcpy(&walk->attr, attr, sizeof(walk->attr));
-	else
-		memset(&walk->attr, 0, sizeof(walk->attr));
-
 	return walk;
 }
 
diff --git a/src/git_revwalk.h b/src/git_revwalk.h
index 5ad6372..d0e7959 100644
--- a/src/git_revwalk.h
+++ b/src/git_revwalk.h
@@ -49,55 +49,6 @@
  */
 GIT_BEGIN_DECL
 
-/** Configuration of a revision pool. */
-typedef struct git_revp_attr git_revp_attr;
-
-/**
- * Allocate an empty pool configuration.
- *
- * The resulting configuration is identical to passing NULL
- * to git_revp_alloc().
- *
- * @return a new configuration block.
- *         NULL if there is insufficient memory.
- */
-GIT_EXTERN(git_revp_attr*) git_revp_attr_alloc(void);
-
-/**
- * Setup the application's per-commit data allocation.
- *
- * If size is non-zero the requested number of bytes is allocated
- * alongside every git_commit used by the revision pool, allowing
- * constant-time access to per-commit application data.
- *
- * If init is not NULL the function is invoked with the commit and
- * the application data pointer, allowing the function to populate
- * the application's data space the first time the commit is parsed
- * into the pool.  Space available within the application data is
- * not initialized.  Subsequent resets do not invoke this method.
- *
- * If init is NULL and size is non-zero the application data space
- * is cleared during the first parse.
- *
- * @param attr the pool configuration to adjust.
- * @param size number of bytes required by the application on
- *        each rev_commit instance within the pool.
- * @param init optional callback function to initialize the
- *        application data space.  If NULL the application
- *        space will be zeroed.  If supplied the application
- *        space may contain random garbage.
- */
-GIT_EXTERN(void) git_revp_attr_appdata(
-	git_revp_attr *attr,
-	size_t size,
-	int (*init)(git_commit *, void *));
-
-/**
- * Free a pool configuration.
- * @param attr the configuration to free.  No-op if NULL.
- */
-GIT_EXTERN(void) git_revp_attr_free(git_revp_attr *attr);
-
 /**
  * Allocate a new revision traversal pool.
  *
@@ -107,13 +58,9 @@ GIT_EXTERN(void) git_revp_attr_free(git_revp_attr *attr);
  * passed configuration after the function completes.
  *
  * @param db the database objects are read from.
- * @param attr configuration for the pool.
- *        NULL to use a default configuration.
  * @return the new traversal handle; NULL if memory is exhausted.
  */
-GIT_EXTERN(git_revp*) git_revp_alloc(
-	git_odb *db,
-	const git_revp_attr *attr);
+GIT_EXTERN(git_revp*) git_revp_alloc(git_odb *db);
 
 /**
  * Reset the traversal machinary for reuse.