Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
da7f9feb
Commit
da7f9feb
authored
Aug 04, 2016
by
Edward Thomson
Committed by
GitHub
Aug 04, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3879 from libgit2/ethomson/mwindow_init
mwindow: init mwindow files in git_libgit2_init
parents
baa87dfc
2381d9e4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
26 deletions
+12
-26
src/global.c
+3
-2
src/mwindow.c
+8
-19
src/mwindow.h
+1
-2
src/odb_pack.c
+0
-3
No files found.
src/global.c
View file @
da7f9feb
...
...
@@ -61,8 +61,9 @@ static int init_common(void)
(
ret
=
git_sysdir_global_init
())
==
0
&&
(
ret
=
git_filter_global_init
())
==
0
&&
(
ret
=
git_merge_driver_global_init
())
==
0
&&
(
ret
=
git_transport_ssh_global_init
())
==
0
)
ret
=
git_openssl_stream_global_init
();
(
ret
=
git_transport_ssh_global_init
())
==
0
&&
(
ret
=
git_openssl_stream_global_init
())
==
0
)
ret
=
git_mwindow_global_init
();
GIT_MEMORY_BARRIER
;
...
...
src/mwindow.c
View file @
da7f9feb
...
...
@@ -33,25 +33,20 @@ static git_mwindow_ctl mem_ctl;
/* Global list of mwindow files, to open packs once across repos */
git_strmap
*
git__pack_cache
=
NULL
;
/**
* Run under mwindow lock
*/
int
git_mwindow_files_init
(
void
)
static
void
git_mwindow_files_free
(
void
)
{
if
(
git__pack_cache
)
return
0
;
git__on_shutdown
(
git_mwindow_files_free
);
git_strmap
*
tmp
=
git__pack_cache
;
return
git_strmap_alloc
(
&
git__pack_cache
);
git__pack_cache
=
NULL
;
git_strmap_free
(
tmp
);
}
void
git_mwindow_files_free
(
void
)
int
git_mwindow_global_init
(
void
)
{
git_strmap
*
tmp
=
git__pack_cache
;
assert
(
!
git__pack_cache
)
;
git__
pack_cache
=
NULL
;
git_strmap_free
(
tmp
);
git__
on_shutdown
(
git_mwindow_files_free
)
;
return
git_strmap_alloc
(
&
git__pack_cache
);
}
int
git_mwindow_get_pack
(
struct
git_pack_file
**
out
,
const
char
*
path
)
...
...
@@ -69,12 +64,6 @@ int git_mwindow_get_pack(struct git_pack_file **out, const char *path)
return
-
1
;
}
if
(
git_mwindow_files_init
()
<
0
)
{
git_mutex_unlock
(
&
git__mwindow_mutex
);
git__free
(
packname
);
return
-
1
;
}
pos
=
git_strmap_lookup_index
(
git__pack_cache
,
packname
);
git__free
(
packname
);
...
...
src/mwindow.h
View file @
da7f9feb
...
...
@@ -43,8 +43,7 @@ int git_mwindow_file_register(git_mwindow_file *mwf);
void
git_mwindow_file_deregister
(
git_mwindow_file
*
mwf
);
void
git_mwindow_close
(
git_mwindow
**
w_cursor
);
int
git_mwindow_files_init
(
void
);
void
git_mwindow_files_free
(
void
);
extern
int
git_mwindow_global_init
(
void
);
struct
git_pack_file
;
/* just declaration to avoid cyclical includes */
int
git_mwindow_get_pack
(
struct
git_pack_file
**
out
,
const
char
*
path
);
...
...
src/odb_pack.c
View file @
da7f9feb
...
...
@@ -591,9 +591,6 @@ int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
struct
pack_backend
*
backend
=
NULL
;
git_buf
path
=
GIT_BUF_INIT
;
if
(
git_mwindow_files_init
()
<
0
)
return
-
1
;
if
(
pack_backend__alloc
(
&
backend
,
8
)
<
0
)
return
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment