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
7bc3d0c8
Commit
7bc3d0c8
authored
Aug 09, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #361 from nulltoken/ntk/fix/wrap-strcmp
util: Add git__strcmp_cb() wrapper
parents
86960158
d1f34693
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
13 deletions
+21
-13
src/refs.c
+4
-5
src/transport_local.c
+1
-8
src/util.c
+14
-0
src/util.h
+2
-0
No files found.
src/refs.c
View file @
7bc3d0c8
...
...
@@ -503,7 +503,7 @@ static int packed_load(git_repository *repo)
ref_cache
->
packfile
=
git_hashtable_alloc
(
default_table_size
,
reftable_hash
,
(
git_hash_keyeq_ptr
)
strcmp
);
(
git_hash_keyeq_ptr
)
(
&
git__strcmp_cb
)
);
if
(
ref_cache
->
packfile
==
NULL
)
{
error
=
GIT_ENOMEM
;
...
...
@@ -1609,7 +1609,7 @@ int git_repository__refcache_init(git_refcache *refs)
refs
->
loose_cache
=
git_hashtable_alloc
(
default_table_size
,
reftable_hash
,
(
git_hash_keyeq_ptr
)
strcmp
);
(
git_hash_keyeq_ptr
)
(
&
git__strcmp_cb
)
);
/* packfile loaded lazily */
refs
->
packfile
=
NULL
;
...
...
@@ -1752,6 +1752,4 @@ int git_reference__normalize_name(char *buffer_out, size_t out_size, const char
int
git_reference__normalize_name_oid
(
char
*
buffer_out
,
size_t
out_size
,
const
char
*
name
)
{
return
normalize_name
(
buffer_out
,
out_size
,
name
,
1
);
}
}
\ No newline at end of file
src/transport_local.c
View file @
7bc3d0c8
...
...
@@ -14,13 +14,6 @@ typedef struct {
git_vector
*
refs
;
}
transport_local
;
static
int
cmp_refs
(
const
void
*
a
,
const
void
*
b
)
{
const
char
*
stra
=
(
const
char
*
)
a
;
const
char
*
strb
=
(
const
char
*
)
b
;
return
strcmp
(
stra
,
strb
);
}
/*
* Try to open the url as a git directory. The direction doesn't
* matter in this case because we're calulating the heads ourselves.
...
...
@@ -147,7 +140,7 @@ static int local_ls(git_transport *transport, git_headarray *array)
return
error
;
/* Sort the references first */
git__tsort
((
void
**
)
refs
.
strings
,
refs
.
count
,
&
cmp_refs
);
git__tsort
((
void
**
)
refs
.
strings
,
refs
.
count
,
&
git__strcmp_cb
);
/* Add HEAD */
error
=
add_ref
(
GIT_HEAD_FILE
,
repo
,
vec
);
...
...
src/util.c
View file @
7bc3d0c8
...
...
@@ -355,3 +355,16 @@ void **git__bsearch(const void *key, void **base, size_t nmemb, int (*compar)(co
return
NULL
;
}
/**
* A strcmp wrapper
*
* We don't want direct pointers to the CRT on Windows, we may
* get stdcall conflicts.
*/
int
git__strcmp_cb
(
const
void
*
a
,
const
void
*
b
)
{
const
char
*
stra
=
(
const
char
*
)
a
;
const
char
*
strb
=
(
const
char
*
)
b
;
return
strcmp
(
stra
,
strb
);
}
\ No newline at end of file
src/util.h
View file @
7bc3d0c8
...
...
@@ -120,4 +120,6 @@ extern void git__tsort(void **dst, size_t size, int (*cmp)(const void *, const v
extern
void
**
git__bsearch
(
const
void
*
key
,
void
**
base
,
size_t
nmemb
,
int
(
*
compar
)(
const
void
*
,
const
void
*
));
extern
int
git__strcmp_cb
(
const
void
*
a
,
const
void
*
b
);
#endif
/* INCLUDE_util_h__ */
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