mirror of
https://github.com/git/git.git
synced 2026-02-28 10:47:33 +00:00
Introduce a new callback function in `struct odb_source` to make the function pluggable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
39 lines
760 B
C
39 lines
760 B
C
#include "git-compat-util.h"
|
|
#include "object-file.h"
|
|
#include "odb/source-files.h"
|
|
#include "odb/source.h"
|
|
#include "packfile.h"
|
|
|
|
struct odb_source *odb_source_new(struct object_database *odb,
|
|
const char *path,
|
|
bool local)
|
|
{
|
|
return &odb_source_files_new(odb, path, local)->base;
|
|
}
|
|
|
|
void odb_source_init(struct odb_source *source,
|
|
struct object_database *odb,
|
|
enum odb_source_type type,
|
|
const char *path,
|
|
bool local)
|
|
{
|
|
source->odb = odb;
|
|
source->type = type;
|
|
source->local = local;
|
|
source->path = xstrdup(path);
|
|
}
|
|
|
|
void odb_source_free(struct odb_source *source)
|
|
{
|
|
if (!source)
|
|
return;
|
|
source->free(source);
|
|
}
|
|
|
|
void odb_source_release(struct odb_source *source)
|
|
{
|
|
if (!source)
|
|
return;
|
|
free(source->path);
|
|
}
|