summaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-12-31 16:06:48 -0800
committerShawn O. Pearce <spearce@spearce.org>2008-12-31 16:06:48 -0800
commit2c4b7707f7e1d591ec1765ab7057a03283841c3e (patch)
treebc584bb33674be3b3925c7bbc129f1f53af21869 /src/util.h
parent5690f02e87e4fd31dfa9fd7c9c01aba03603cde8 (diff)
downloadlibgit2-2c4b7707f7e1d591ec1765ab7057a03283841c3e.tar.gz
Add git__fmt as an easier to use snprintf
Checking the return value of snprintf is a pain, as it must be >= 0 and < sizeof(buffer). git__fmt is a simple wrapper to perform these checks. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 8e8169ce5..018fce57e 100644
--- a/src/util.h
+++ b/src/util.h
@@ -26,6 +26,8 @@ extern char *git__strdup(const char *);
# define strdup(a) GIT__FORBID_MALLOC
#endif
+extern int git__fmt(char *, size_t, const char *, ...)
+ GIT_FORMAT_PRINTF(3, 4);
extern int git__prefixcmp(const char *str, const char *prefix);
extern int git__suffixcmp(const char *str, const char *suffix);