summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-07 09:54:33 -0700
committerRussell Belfer <rb@github.com>2013-06-07 09:54:33 -0700
commit3e9e6cdaff8acb11399736abbf793bf2d000d037 (patch)
tree4e1f3ed201309ae8a3668091e7952c26b6e7a836 /src/util.h
parent1a42dd17eb2c35fa572418f5958595cbe297d229 (diff)
downloadlibgit2-3e9e6cdaff8acb11399736abbf793bf2d000d037.tar.gz
Add safe memset and use it
This adds a `git__memset` routine that will not be optimized away and updates the places where I memset() right before a free() call to use it.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/util.h b/src/util.h
index 5ae87ac10..fd3ea22ed 100644
--- a/src/util.h
+++ b/src/util.h
@@ -293,8 +293,7 @@ GIT_INLINE(bool) git__iswildcard(int c)
}
/*
- * Parse a string value as a boolean, just like Core Git
- * does.
+ * Parse a string value as a boolean, just like Core Git does.
*
* Valid values for true are: 'true', 'yes', 'on'
* Valid values for false are: 'false', 'no', 'off'
@@ -309,7 +308,7 @@ extern int git__parse_bool(int *out, const char *value);
* - "July 17, 2003"
* - "2003-7-17 08:23"
*/
-int git__date_parse(git_time_t *out, const char *date);
+extern int git__date_parse(git_time_t *out, const char *date);
/*
* Unescapes a string in-place.
@@ -320,4 +319,10 @@ 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()`.
+ */
+extern void git__memset(void *data, int c, size_t size);
+
#endif /* INCLUDE_util_h__ */