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
6de9b2ee
Commit
6de9b2ee
authored
Jun 12, 2013
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: It's called `memzero`
parent
eb58e2d0
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12 additions
and
13 deletions
+12
-13
src/cache.c
+1
-1
src/config.c
+1
-1
src/diff.c
+1
-1
src/index.c
+1
-1
src/odb.c
+1
-1
src/refdb.c
+1
-1
src/repository.c
+1
-1
src/util.c
+2
-3
src/util.h
+3
-3
No files found.
src/cache.c
View file @
6de9b2ee
...
...
@@ -107,7 +107,7 @@ void git_cache_free(git_cache *cache)
git_cache_clear
(
cache
);
git_oidmap_free
(
cache
->
map
);
git_mutex_free
(
&
cache
->
lock
);
git__mem
set
(
cache
,
0
,
sizeof
(
*
cache
));
git__mem
zero
(
cache
,
sizeof
(
*
cache
));
}
/* Called with lock */
...
...
src/config.c
View file @
6de9b2ee
...
...
@@ -47,7 +47,7 @@ static void config_free(git_config *cfg)
git_vector_free
(
&
cfg
->
files
);
git__mem
set
(
cfg
,
0
,
sizeof
(
*
cfg
));
git__mem
zero
(
cfg
,
sizeof
(
*
cfg
));
git__free
(
cfg
);
}
...
...
src/diff.c
View file @
6de9b2ee
...
...
@@ -466,7 +466,7 @@ static void diff_list_free(git_diff_list *diff)
git_pathspec_free
(
&
diff
->
pathspec
);
git_pool_clear
(
&
diff
->
pool
);
git__mem
set
(
diff
,
0
,
sizeof
(
*
diff
));
git__mem
zero
(
diff
,
sizeof
(
*
diff
));
git__free
(
diff
);
}
...
...
src/index.c
View file @
6de9b2ee
...
...
@@ -349,7 +349,7 @@ static void index_free(git_index *index)
git__free
(
index
->
index_file_path
);
git__mem
set
(
index
,
0
,
sizeof
(
*
index
));
git__mem
zero
(
index
,
sizeof
(
*
index
));
git__free
(
index
);
}
...
...
src/odb.c
View file @
6de9b2ee
...
...
@@ -590,7 +590,7 @@ static void odb_free(git_odb *db)
git_vector_free
(
&
db
->
backends
);
git_cache_free
(
&
db
->
own_cache
);
git__mem
set
(
db
,
0
,
sizeof
(
*
db
));
git__mem
zero
(
db
,
sizeof
(
*
db
));
git__free
(
db
);
}
...
...
src/refdb.c
View file @
6de9b2ee
...
...
@@ -89,7 +89,7 @@ int git_refdb_compress(git_refdb *db)
void
git_refdb__free
(
git_refdb
*
db
)
{
refdb_free_backend
(
db
);
git__mem
set
(
db
,
0
,
sizeof
(
*
db
));
git__mem
zero
(
db
,
sizeof
(
*
db
));
git__free
(
db
);
}
...
...
src/repository.c
View file @
6de9b2ee
...
...
@@ -119,7 +119,7 @@ void git_repository_free(git_repository *repo)
git__free
(
repo
->
workdir
);
git__free
(
repo
->
namespace
);
git__mem
set
(
repo
,
0
,
sizeof
(
*
repo
));
git__mem
zero
(
repo
,
sizeof
(
*
repo
));
git__free
(
repo
);
}
...
...
src/util.c
View file @
6de9b2ee
...
...
@@ -723,12 +723,11 @@ void git__insertsort_r(
git__free
(
swapel
);
}
void
git__mem
set
(
void
*
data
,
int
c
,
size_t
size
)
void
git__mem
zero
(
volatile
void
*
data
,
size_t
size
)
{
volatile
uint8_t
*
scan
=
data
;
uint8_t
*
end
=
scan
+
size
;
uint8_t
val
=
(
uint8_t
)
c
;
while
(
scan
<
end
)
*
scan
++
=
val
;
*
scan
++
=
0x0
;
}
src/util.h
View file @
6de9b2ee
...
...
@@ -322,9 +322,9 @@ extern int git__date_parse(git_time_t *out, const char *date);
extern
size_t
git__unescape
(
char
*
str
);
/*
*
Memset that will not be optimized away by the compiler.
*
You usually should just use regular `memset()`
.
*
Safely zero-out memory, making sure that the compiler
*
doesn't optimize away the operation
.
*/
extern
void
git__mem
set
(
void
*
data
,
int
c
,
size_t
size
);
extern
void
git__mem
zero
(
volatile
void
*
data
,
size_t
size
);
#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