summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-09-17 17:13:25 +0200
committerVicent Marti <vicent@github.com>2014-09-17 17:13:25 +0200
commit14556cbff7d8728d1dfed3b6decd097c87132387 (patch)
tree76a4a36a765b6c6305f53d42c42abb5fed228893 /examples
parent6340e8f5d0a54fab2ef9292e6c1e1a2e62b17310 (diff)
parent3b2cb2c91ee77e5e45957e8355025e3e742c07bd (diff)
downloadlibgit2-14556cbff7d8728d1dfed3b6decd097c87132387.tar.gz
Merge pull request #2567 from cirosantilli/factor-41
Factor 40 and 41 constants from source.
Diffstat (limited to 'examples')
-rw-r--r--examples/general.c4
-rw-r--r--examples/rev-list.c4
-rw-r--r--examples/showindex.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/examples/general.c b/examples/general.c
index ae8756338..051d69380 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -94,8 +94,8 @@ int main (int argc, char** argv)
// Next we will convert the 20 byte raw SHA1 value to a human readable 40
// char hex value.
printf("\n*Raw to Hex*\n");
- char out[41];
- out[40] = '\0';
+ char out[GIT_OID_HEXSZ+1];
+ out[GIT_OID_HEXSZ] = '\0';
// If you have a oid, you can easily get the hex value of the SHA as well.
git_oid_fmt(out, &oid);
diff --git a/examples/rev-list.c b/examples/rev-list.c
index 5c0d751a3..940a01136 100644
--- a/examples/rev-list.c
+++ b/examples/rev-list.c
@@ -22,7 +22,7 @@ int main (int argc, char **argv)
git_repository *repo;
git_revwalk *walk;
git_oid oid;
- char buf[41];
+ char buf[GIT_OID_HEXSZ+1];
git_threads_init();
@@ -32,7 +32,7 @@ int main (int argc, char **argv)
while (!git_revwalk_next(&oid, walk)) {
git_oid_fmt(buf, &oid);
- buf[40] = '\0';
+ buf[GIT_OID_HEXSZ] = '\0';
printf("%s\n", buf);
}
diff --git a/examples/showindex.c b/examples/showindex.c
index ad4a16e8e..604124f12 100644
--- a/examples/showindex.c
+++ b/examples/showindex.c
@@ -20,8 +20,8 @@ int main (int argc, char** argv)
unsigned int i, ecount;
char *dir = ".";
size_t dirlen;
- char out[41];
- out[40] = '\0';
+ char out[GIT_OID_HEXSZ+1];
+ out[GIT_OID_HEXSZ] = '\0';
git_threads_init();