| 1 | #include "git-compat-util.h" |
| 2 | #include "object-file.h" |
| 3 | #include "odb/source-files.h" |
| 4 | #include "odb/source.h" |
| 5 | #include "packfile.h" |
| 6 | |
| 7 | struct odb_source *odb_source_new(struct object_database *odb, |
| 8 | const char *path, |
| 9 | bool local) |
| 10 | { |
| 11 | return &odb_source_files_new(odb, path, local)->base; |
| 12 | } |
| 13 | |
| 14 | void odb_source_init(struct odb_source *source, |
| 15 | struct object_database *odb, |
| 16 | enum odb_source_type type, |
| 17 | const char *path, |
| 18 | bool local) |
| 19 | { |
| 20 | source->odb = odb; |
| 21 | source->type = type; |
| 22 | source->local = local; |
| 23 | source->path = xstrdup(path); |
| 24 | } |
| 25 | |
| 26 | void odb_source_free(struct odb_source *source) |
| 27 | { |
| 28 | if (!source) |
| 29 | return; |
| 30 | source->free(source); |
| 31 | } |
| 32 | |
| 33 | void odb_source_release(struct odb_source *source) |
| 34 | { |
| 35 | if (!source) |
| 36 | return; |
| 37 | free(source->path); |
| 38 | } |