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
85d2748c
Commit
85d2748c
authored
Jan 27, 2017
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
khash: avoid using `kh_key`/`kh_val` as lvalue
parent
f31cb45a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
20 additions
and
17 deletions
+20
-17
src/cache.c
+2
-2
src/indexer.c
+2
-2
src/odb_mempack.c
+2
-2
src/oidmap.h
+5
-3
src/pack-objects.c
+2
-2
src/pack.c
+1
-1
src/revwalk.c
+1
-1
src/sortedcache.c
+2
-2
src/strmap.h
+1
-0
tests/core/oidmap.c
+2
-2
No files found.
src/cache.c
View file @
85d2748c
...
...
@@ -219,8 +219,8 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
git_cached_obj_decref
(
stored_entry
);
git_cached_obj_incref
(
entry
);
git_oidmap_
key
(
cache
->
map
,
pos
)
=
&
entry
->
oid
;
git_oidmap_
value_at
(
cache
->
map
,
pos
)
=
entry
;
git_oidmap_
set_key_at
(
cache
->
map
,
pos
,
&
entry
->
oid
)
;
git_oidmap_
set_value_at
(
cache
->
map
,
pos
,
entry
)
;
}
else
{
/* NO OP */
}
...
...
src/indexer.c
View file @
85d2748c
...
...
@@ -308,7 +308,7 @@ static int store_object(git_indexer *idx)
}
git_oidmap_
value_at
(
idx
->
pack
->
idx_cache
,
k
)
=
pentry
;
git_oidmap_
set_value_at
(
idx
->
pack
->
idx_cache
,
k
,
pentry
)
;
git_oid_cpy
(
&
entry
->
oid
,
&
oid
);
...
...
@@ -356,7 +356,7 @@ static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_ent
return
-
1
;
}
git_oidmap_
value_at
(
idx
->
pack
->
idx_cache
,
k
)
=
pentry
;
git_oidmap_
set_value_at
(
idx
->
pack
->
idx_cache
,
k
,
pentry
)
;
/* Add the object to the list */
if
(
git_vector_insert
(
&
idx
->
objects
,
entry
)
<
0
)
...
...
src/odb_mempack.c
View file @
85d2748c
...
...
@@ -57,8 +57,8 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
obj
->
len
=
len
;
obj
->
type
=
type
;
git_oidmap_
key
(
db
->
objects
,
pos
)
=
&
obj
->
oid
;
git_oidmap_
value_at
(
db
->
objects
,
pos
)
=
obj
;
git_oidmap_
set_key_at
(
db
->
objects
,
pos
,
&
obj
->
oid
)
;
git_oidmap_
set_value_at
(
db
->
objects
,
pos
,
obj
)
;
if
(
type
==
GIT_OBJ_COMMIT
)
{
struct
memobject
**
store
=
git_array_alloc
(
db
->
commits
);
...
...
src/oidmap.h
View file @
85d2748c
...
...
@@ -39,9 +39,11 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
#define git_oidmap_exists(h, k) (kh_get(oid, h, k) != kh_end(h))
#define git_oidmap_has_data(h, idx) kh_exist(h, idx)
#define git_oidmap_key(h, idx) kh_key(h, idx)
#define git_oidmap_value_at(h, idx) kh_val(h, idx)
#define git_oidmap_delete_at(h, idx) kh_del(oid, h, idx)
#define git_oidmap_key(h, idx) kh_key(h, idx)
#define git_oidmap_set_key_at(h, idx, k) kh_key(h, idx) = k
#define git_oidmap_value_at(h, idx) kh_val(h, idx)
#define git_oidmap_set_value_at(h, idx, v) kh_val(h, idx) = v
#define git_oidmap_delete_at(h, idx) kh_del(oid, h, idx)
#define git_oidmap_put(h, k, err) kh_put(oid, h, k, err)
...
...
src/pack-objects.c
View file @
85d2748c
...
...
@@ -200,7 +200,7 @@ static void rehash(git_packbuilder *pb)
git_oidmap_clear
(
pb
->
object_ix
);
for
(
i
=
0
,
po
=
pb
->
object_list
;
i
<
pb
->
nr_objects
;
i
++
,
po
++
)
{
pos
=
git_oidmap_put
(
pb
->
object_ix
,
&
po
->
id
,
&
ret
);
git_oidmap_
value_at
(
pb
->
object_ix
,
pos
)
=
po
;
git_oidmap_
set_value_at
(
pb
->
object_ix
,
pos
,
po
)
;
}
}
...
...
@@ -252,7 +252,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
return
ret
;
}
assert
(
ret
!=
0
);
git_oidmap_
value_at
(
pb
->
object_ix
,
pos
)
=
po
;
git_oidmap_
set_value_at
(
pb
->
object_ix
,
pos
,
po
)
;
pb
->
done
=
false
;
...
...
src/pack.c
View file @
85d2748c
...
...
@@ -171,7 +171,7 @@ static int cache_add(
k
=
git_offmap_put
(
cache
->
entries
,
offset
,
&
error
);
assert
(
error
!=
0
);
git_o
idmap_value_at
(
cache
->
entries
,
k
)
=
entry
;
git_o
ffmap_set_value_at
(
cache
->
entries
,
k
,
entry
)
;
cache
->
memory_used
+=
entry
->
raw
.
len
;
*
cached_out
=
entry
;
...
...
src/revwalk.c
View file @
85d2748c
...
...
@@ -37,7 +37,7 @@ git_commit_list_node *git_revwalk__commit_lookup(
pos
=
git_oidmap_put
(
walk
->
commits
,
&
commit
->
oid
,
&
ret
);
assert
(
ret
!=
0
);
git_oidmap_
value_at
(
walk
->
commits
,
pos
)
=
commit
;
git_oidmap_
set_value_at
(
walk
->
commits
,
pos
,
commit
)
;
return
commit
;
}
...
...
src/sortedcache.c
View file @
85d2748c
...
...
@@ -299,8 +299,8 @@ int git_sortedcache_upsert(void **out, git_sortedcache *sc, const char *key)
goto
done
;
if
(
!
error
)
git_strmap_
key
(
sc
->
map
,
pos
)
=
item_key
;
git_strmap_
value_at
(
sc
->
map
,
pos
)
=
item
;
git_strmap_
set_key_at
(
sc
->
map
,
pos
,
item_key
)
;
git_strmap_
set_value_at
(
sc
->
map
,
pos
,
item
)
;
error
=
git_vector_insert
(
&
sc
->
items
,
item
);
if
(
error
<
0
)
...
...
src/strmap.h
View file @
85d2748c
...
...
@@ -38,6 +38,7 @@ typedef khiter_t git_strmap_iter;
#define git_strmap_has_data(h, idx) kh_exist(h, idx)
#define git_strmap_key(h, idx) kh_key(h, idx)
#define git_strmap_set_key_at(h, idx, k) kh_val(h, idx) = k
#define git_strmap_value_at(h, idx) kh_val(h, idx)
#define git_strmap_set_value_at(h, idx, v) kh_val(h, idx) = v
#define git_strmap_delete_at(h, idx) kh_del(str, h, idx)
...
...
tests/core/oidmap.c
View file @
85d2748c
...
...
@@ -39,7 +39,7 @@ void test_core_oidmap__basic(void)
pos
=
git_oidmap_put
(
map
,
&
items
[
i
].
oid
,
&
ret
);
cl_assert
(
ret
!=
0
);
git_oidmap_
value_at
(
map
,
pos
)
=
&
items
[
i
]
;
git_oidmap_
set_value_at
(
map
,
pos
,
&
items
[
i
])
;
}
...
...
@@ -93,7 +93,7 @@ void test_core_oidmap__hash_collision(void)
pos
=
git_oidmap_put
(
map
,
&
items
[
i
].
oid
,
&
ret
);
cl_assert
(
ret
!=
0
);
git_oidmap_
value_at
(
map
,
pos
)
=
&
items
[
i
]
;
git_oidmap_
set_value_at
(
map
,
pos
,
&
items
[
i
])
;
}
...
...
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