summaryrefslogtreecommitdiff
path: root/src/htssafe.h
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-08-27 17:01:26 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-08-27 17:01:26 +0000
commit75814fb6055d9188d4462182e53f7feab6e7e06f (patch)
tree91f02ee9a8dfa50475c204d39cc11877dd98c2bb /src/htssafe.h
parenta23976f732b211fef6d95bbd8f120c86f4188ec8 (diff)
Do not include execinfo.h if missing (Android)
Do not use strnlen if missing (Mac OS X 10.6.8) ( nthpowers)
Diffstat (limited to 'src/htssafe.h')
-rw-r--r--src/htssafe.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/htssafe.h b/src/htssafe.h
index 9de63a3..f938094 100644
--- a/src/htssafe.h
+++ b/src/htssafe.h
@@ -175,6 +175,13 @@ static HTS_UNUSED void htssafe_compile_time_check_(void) {
HTS_IS_NOT_CHAR_BUFFER(B) ? (size_t) -1 : sizeof(B), \
"overflow while copying '" #B "' to '"#A"'", __FILE__, __LINE__)
+/** strnlen replacement (autotools). **/
+static HTS_UNUSED size_t rpl_strnlen(const char *s, size_t maxlen) {
+ size_t i;
+ for(i = 0 ; s[i] != '\0' && i < maxlen ; i++) ;
+ return i;
+}
+
static HTS_INLINE HTS_UNUSED size_t strlen_safe_(const char *source, const size_t sizeof_source,
const char *file, int line) {
size_t size;