Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-03-08 01:09:21 +0300
committerShawn O. Pearce <spearce@spearce.org>2007-03-08 01:11:02 +0300
commit93e72d8d8fbfbbf28abee82c3e769337d7b940ec (patch)
treec3f37f1085850b9e2ab15e648dba26e4e1a4382b /fast-import.c
parentc390ae97beb9e8cdab159b593ea9659e8096c4db (diff)
Preallocate memory earlier in fast-import
I'm about to teach fast-import how to reload the marks file created by a prior session. The general approach that I want to use is to immediately parse the marks file when the specific argument is found in argv, thereby allowing the caller to supply multiple marks files, as the mark space can be sparsely populated. To make that work out we need to allocate our object tables before we parse the command line options. Since none of these tables depend on the command line options, we can easily relocate them. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fast-import.c b/fast-import.c
index cc3347b23d..28f5e7c3b1 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1988,6 +1988,12 @@ int main(int argc, const char **argv)
int i, show_stats = 1;
git_config(git_default_config);
+ alloc_objects(object_entry_alloc);
+ strbuf_init(&command_buf);
+ atom_table = xcalloc(atom_table_sz, sizeof(struct atom_str*));
+ branch_table = xcalloc(branch_table_sz, sizeof(struct branch*));
+ avail_tree_table = xcalloc(avail_tree_table_sz, sizeof(struct avail_tree_content*));
+ marks = pool_calloc(1, sizeof(struct mark_set));
for (i = 1; i < argc; i++) {
const char *a = argv[i];
@@ -2031,14 +2037,6 @@ int main(int argc, const char **argv)
if (i != argc)
usage(fast_import_usage);
- alloc_objects(object_entry_alloc);
- strbuf_init(&command_buf);
-
- atom_table = xcalloc(atom_table_sz, sizeof(struct atom_str*));
- branch_table = xcalloc(branch_table_sz, sizeof(struct branch*));
- avail_tree_table = xcalloc(avail_tree_table_sz, sizeof(struct avail_tree_content*));
- marks = pool_calloc(1, sizeof(struct mark_set));
-
start_packfile();
for (;;) {
read_next_command();