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
73028af8
Commit
73028af8
authored
Jan 27, 2017
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
khash: avoid using macro magic to get return address
parent
85d2748c
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
37 additions
and
37 deletions
+37
-37
src/attr.c
+1
-1
src/attrcache.c
+2
-2
src/cache.c
+1
-1
src/config_file.c
+1
-1
src/describe.c
+1
-1
src/diff_driver.c
+2
-2
src/fileops.c
+1
-1
src/idxmap.h
+6
-6
src/index.c
+5
-5
src/mwindow.c
+1
-1
src/offmap.h
+3
-3
src/oidmap.h
+3
-3
src/pack-objects.c
+1
-1
src/strmap.h
+3
-3
src/submodule.c
+2
-2
src/transaction.c
+1
-1
src/tree.c
+2
-2
tests/core/strmap.c
+1
-1
No files found.
src/attr.c
View file @
73028af8
...
...
@@ -209,7 +209,7 @@ int git_attr_foreach(
if
(
git_strmap_exists
(
seen
,
assign
->
name
))
continue
;
git_strmap_insert
(
seen
,
assign
->
name
,
assign
,
error
);
git_strmap_insert
(
seen
,
assign
->
name
,
assign
,
&
error
);
if
(
error
<
0
)
goto
cleanup
;
...
...
src/attrcache.c
View file @
73028af8
...
...
@@ -82,7 +82,7 @@ static int attr_cache_make_entry(
&
entry
,
git_repository_workdir
(
repo
),
path
,
&
cache
->
pool
);
if
(
!
error
)
{
git_strmap_insert
(
cache
->
files
,
entry
->
path
,
entry
,
error
);
git_strmap_insert
(
cache
->
files
,
entry
->
path
,
entry
,
&
error
);
if
(
error
>
0
)
error
=
0
;
}
...
...
@@ -435,7 +435,7 @@ int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)
giterr_set
(
GITERR_OS
,
"unable to get attr cache lock"
);
error
=
-
1
;
}
else
{
git_strmap_insert
(
macros
,
macro
->
match
.
pattern
,
macro
,
error
);
git_strmap_insert
(
macros
,
macro
->
match
.
pattern
,
macro
,
&
error
);
git_mutex_unlock
(
&
cache
->
lock
);
}
...
...
src/cache.c
View file @
73028af8
...
...
@@ -199,7 +199,7 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
if
(
!
git_oidmap_valid_index
(
cache
->
map
,
pos
))
{
int
rval
;
git_oidmap_insert
(
cache
->
map
,
&
entry
->
oid
,
entry
,
rval
);
git_oidmap_insert
(
cache
->
map
,
&
entry
->
oid
,
entry
,
&
rval
);
if
(
rval
>=
0
)
{
git_cached_obj_incref
(
entry
);
cache
->
used_memory
+=
entry
->
size
;
...
...
src/config_file.c
View file @
73028af8
...
...
@@ -179,7 +179,7 @@ static int append_entry(git_strmap *values, cvar_t *var)
pos
=
git_strmap_lookup_index
(
values
,
var
->
entry
->
name
);
if
(
!
git_strmap_valid_index
(
values
,
pos
))
{
git_strmap_insert
(
values
,
var
->
entry
->
name
,
var
,
error
);
git_strmap_insert
(
values
,
var
->
entry
->
name
,
var
,
&
error
);
}
else
{
existing
=
git_strmap_value_at
(
values
,
pos
);
while
(
existing
->
next
!=
NULL
)
{
...
...
src/describe.c
View file @
73028af8
...
...
@@ -127,7 +127,7 @@ static int add_to_known_names(
if
(
!
found
)
{
int
ret
;
git_oidmap_insert
(
names
,
&
e
->
peeled
,
e
,
ret
);
git_oidmap_insert
(
names
,
&
e
->
peeled
,
e
,
&
ret
);
if
(
ret
<
0
)
return
-
1
;
}
...
...
src/diff_driver.c
View file @
73028af8
...
...
@@ -217,7 +217,7 @@ static int git_diff_driver_builtin(
goto
done
;
}
git_strmap_insert
(
reg
->
drivers
,
drv
->
name
,
drv
,
error
);
git_strmap_insert
(
reg
->
drivers
,
drv
->
name
,
drv
,
&
error
);
if
(
error
>
0
)
error
=
0
;
...
...
@@ -331,7 +331,7 @@ static int git_diff_driver_load(
goto
done
;
/* store driver in registry */
git_strmap_insert
(
reg
->
drivers
,
drv
->
name
,
drv
,
error
);
git_strmap_insert
(
reg
->
drivers
,
drv
->
name
,
drv
,
&
error
);
if
(
error
<
0
)
goto
done
;
error
=
0
;
...
...
src/fileops.c
View file @
73028af8
...
...
@@ -607,7 +607,7 @@ retry_lstat:
memcpy
(
cache_path
,
make_path
.
ptr
,
make_path
.
size
+
1
);
git_strmap_insert
(
opts
->
dir_map
,
cache_path
,
cache_path
,
error
);
git_strmap_insert
(
opts
->
dir_map
,
cache_path
,
cache_path
,
&
error
);
if
(
error
<
0
)
goto
done
;
}
...
...
src/idxmap.h
View file @
73028af8
...
...
@@ -51,16 +51,16 @@ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
((*(hp) = kh_init(idxicase)) == NULL) ? giterr_set_oom(), -1 : 0
#define git_idxmap_insert(h, key, val, rval) do { \
khiter_t __pos = kh_put(idx, h, key,
&
rval); \
if (
rval
>= 0) { \
if (
rval
== 0) kh_key(h, __pos) = key; \
khiter_t __pos = kh_put(idx, h, key, rval); \
if (
(*rval)
>= 0) { \
if (
(*rval)
== 0) kh_key(h, __pos) = key; \
kh_val(h, __pos) = val; \
} } while (0)
#define git_idxmap_icase_insert(h, key, val, rval) do { \
khiter_t __pos = kh_put(idxicase, h, key,
&
rval); \
if (
rval
>= 0) { \
if (
rval
== 0) kh_key(h, __pos) = key; \
khiter_t __pos = kh_put(idxicase, h, key, rval); \
if (
(*rval)
>= 0) { \
if (
(*rval)
== 0) kh_key(h, __pos) = key; \
kh_val(h, __pos) = val; \
} } while (0)
...
...
src/index.c
View file @
73028af8
...
...
@@ -1365,7 +1365,7 @@ static int index_insert(
error
=
git_vector_insert_sorted
(
&
index
->
entries
,
entry
,
index_no_dups
);
if
(
error
==
0
)
{
INSERT_IN_MAP
(
index
,
entry
,
error
);
INSERT_IN_MAP
(
index
,
entry
,
&
error
);
}
}
...
...
@@ -1592,7 +1592,7 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
if
((
ret
=
git_vector_insert
(
&
index
->
entries
,
entry
))
<
0
)
break
;
INSERT_IN_MAP
(
index
,
entry
,
ret
);
INSERT_IN_MAP
(
index
,
entry
,
&
ret
);
if
(
ret
<
0
)
break
;
}
...
...
@@ -2499,7 +2499,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
goto
done
;
}
INSERT_IN_MAP
(
index
,
entry
,
error
);
INSERT_IN_MAP
(
index
,
entry
,
&
error
);
if
(
error
<
0
)
{
index_entry_free
(
entry
);
...
...
@@ -2984,7 +2984,7 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
kh_resize
(
idx
,
entries_map
,
entries
.
length
);
git_vector_foreach
(
&
entries
,
i
,
e
)
{
INSERT_IN_MAP_EX
(
index
,
entries_map
,
e
,
error
);
INSERT_IN_MAP_EX
(
index
,
entries_map
,
e
,
&
error
);
if
(
error
<
0
)
{
giterr_set
(
GITERR_INDEX
,
"failed to insert entry into map"
);
...
...
@@ -3103,7 +3103,7 @@ static int git_index_read_iterator(
if
(
add_entry
)
{
if
((
error
=
git_vector_insert
(
&
new_entries
,
add_entry
))
==
0
)
INSERT_IN_MAP_EX
(
index
,
new_entries_map
,
add_entry
,
error
);
INSERT_IN_MAP_EX
(
index
,
new_entries_map
,
add_entry
,
&
error
);
}
if
(
remove_entry
&&
error
>=
0
)
...
...
src/mwindow.c
View file @
73028af8
...
...
@@ -84,7 +84,7 @@ int git_mwindow_get_pack(struct git_pack_file **out, const char *path)
git_atomic_inc
(
&
pack
->
refcount
);
git_strmap_insert
(
git__pack_cache
,
pack
->
pack_name
,
pack
,
error
);
git_strmap_insert
(
git__pack_cache
,
pack
->
pack_name
,
pack
,
&
error
);
git_mutex_unlock
(
&
git__mwindow_mutex
);
if
(
error
<
0
)
{
...
...
src/offmap.h
View file @
73028af8
...
...
@@ -41,9 +41,9 @@ typedef khash_t(off) git_offmap;
#define git_offmap_put(h, k, err) kh_put(off, h, k, err)
#define git_offmap_insert(h, key, val, rval) do { \
khiter_t __pos = kh_put(off, h, key,
&
rval); \
if (
rval
>= 0) { \
if (
rval
== 0) kh_key(h, __pos) = key; \
khiter_t __pos = kh_put(off, h, key, rval); \
if (
(*rval)
>= 0) { \
if (
(*rval)
== 0) kh_key(h, __pos) = key; \
kh_val(h, __pos) = val; \
} } while (0)
...
...
src/oidmap.h
View file @
73028af8
...
...
@@ -48,9 +48,9 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
#define git_oidmap_put(h, k, err) kh_put(oid, h, k, err)
#define git_oidmap_insert(h, key, val, rval) do { \
khiter_t __pos = kh_put(oid, h, key,
&
rval); \
if (
rval
>= 0) { \
if (
rval
== 0) kh_key(h, __pos) = key; \
khiter_t __pos = kh_put(oid, h, key, rval); \
if (
(*rval)
>= 0) { \
if (
(*rval)
== 0) kh_key(h, __pos) = key; \
kh_val(h, __pos) = val; \
} } while (0)
...
...
src/pack-objects.c
View file @
73028af8
...
...
@@ -1540,7 +1540,7 @@ static int retrieve_object(git_walk_object **out, git_packbuilder *pb, const git
if
((
error
=
lookup_walk_object
(
&
obj
,
pb
,
id
))
<
0
)
return
error
;
git_oidmap_insert
(
pb
->
walk_objects
,
&
obj
->
id
,
obj
,
error
);
git_oidmap_insert
(
pb
->
walk_objects
,
&
obj
->
id
,
obj
,
&
error
);
}
*
out
=
obj
;
...
...
src/strmap.h
View file @
73028af8
...
...
@@ -46,9 +46,9 @@ typedef khiter_t git_strmap_iter;
#define git_strmap_put(h, k, err) kh_put(str, h, k, err)
#define git_strmap_insert(h, key, val, rval) do { \
khiter_t __pos = kh_put(str, h, key,
&
rval); \
if (
rval
>= 0) { \
if (
rval
== 0) kh_key(h, __pos) = key; \
khiter_t __pos = kh_put(str, h, key, rval); \
if (
(*rval)
>= 0) { \
if (
(*rval)
== 0) kh_key(h, __pos) = key; \
kh_val(h, __pos) = val; \
} } while (0)
...
...
src/submodule.c
View file @
73028af8
...
...
@@ -186,7 +186,7 @@ static int load_submodule_names(git_strmap *out, git_config *cfg)
ldot
=
strrchr
(
entry
->
name
,
'.'
);
git_buf_put
(
&
buf
,
fdot
+
1
,
ldot
-
fdot
-
1
);
git_strmap_insert
(
out
,
entry
->
value
,
git_buf_detach
(
&
buf
),
rval
);
git_strmap_insert
(
out
,
entry
->
value
,
git_buf_detach
(
&
buf
),
&
rval
);
if
(
rval
<
0
)
{
giterr_set
(
GITERR_NOMEMORY
,
"error inserting submodule into hash table"
);
return
-
1
;
...
...
@@ -1866,7 +1866,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
goto
done
;
}
git_strmap_insert
(
map
,
sm
->
name
,
sm
,
error
);
git_strmap_insert
(
map
,
sm
->
name
,
sm
,
&
error
);
assert
(
error
!=
0
);
if
(
error
<
0
)
goto
done
;
...
...
src/transaction.c
View file @
73028af8
...
...
@@ -120,7 +120,7 @@ int git_transaction_lock_ref(git_transaction *tx, const char *refname)
if
((
error
=
git_refdb_lock
(
&
node
->
payload
,
tx
->
db
,
refname
))
<
0
)
return
error
;
git_strmap_insert
(
tx
->
locks
,
node
->
name
,
node
,
error
);
git_strmap_insert
(
tx
->
locks
,
node
->
name
,
node
,
&
error
);
if
(
error
<
0
)
goto
cleanup
;
...
...
src/tree.c
View file @
73028af8
...
...
@@ -505,7 +505,7 @@ static int append_entry(
entry
->
attr
=
(
uint16_t
)
filemode
;
git_strmap_insert
(
bld
->
map
,
entry
->
filename
,
entry
,
error
);
git_strmap_insert
(
bld
->
map
,
entry
->
filename
,
entry
,
&
error
);
if
(
error
<
0
)
{
git_tree_entry_free
(
entry
);
giterr_set
(
GITERR_TREE
,
"failed to append entry %s to the tree builder"
,
filename
);
...
...
@@ -754,7 +754,7 @@ int git_treebuilder_insert(
entry
=
alloc_entry
(
filename
,
strlen
(
filename
),
id
);
GITERR_CHECK_ALLOC
(
entry
);
git_strmap_insert
(
bld
->
map
,
entry
->
filename
,
entry
,
error
);
git_strmap_insert
(
bld
->
map
,
entry
->
filename
,
entry
,
&
error
);
if
(
error
<
0
)
{
git_tree_entry_free
(
entry
);
...
...
tests/core/strmap.c
View file @
73028af8
...
...
@@ -36,7 +36,7 @@ static void insert_strings(git_strmap *table, int count)
for
(
j
=
0
,
over
=
i
/
26
;
over
>
0
;
j
++
,
over
=
over
/
26
)
str
[
j
]
=
'A'
+
(
over
%
26
);
git_strmap_insert
(
table
,
str
,
str
,
err
);
git_strmap_insert
(
table
,
str
,
str
,
&
err
);
cl_assert
(
err
>=
0
);
}
...
...
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