Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-02-05 16:49:51 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2014-02-05 17:31:13 +0400
commit1e6f0ac4360bae25ef0a9618c9b091192b8e8997 (patch)
tree07b735340bc480d9982a8f6f16a7c296ab0d4a8a /src/util.h
parenta6563619e98437a99ff49eef590f62dbb1584358 (diff)
utils: don't reimplement strnlen
The standard library provides a very nice strnlen function, which knows to use SSE, let's not reimplement it ourselves.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h
index f9de909e9..c18221f49 100644
--- a/src/util.h
+++ b/src/util.h
@@ -7,6 +7,7 @@
#ifndef INCLUDE_util_h__
#define INCLUDE_util_h__
+#include "posix.h"
#include "common.h"
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
@@ -50,8 +51,7 @@ GIT_INLINE(char *) git__strndup(const char *str, size_t n)
size_t length = 0;
char *ptr;
- while (length < n && str[length])
- ++length;
+ length = p_strnlen(str, n);
ptr = (char*)git__malloc(length + 1);