Skip to content

Commit

Permalink
Hack in a solaris fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Aug 3, 2021
1 parent d96a0e8 commit 4a878a1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/readstat/stata/readstat_dta_read.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

#define _XOPEN_SOURCE 700 /* for strnlen */

#include <stdlib.h>
#include <math.h>
#include <time.h>
Expand All @@ -9,6 +6,16 @@
#include <inttypes.h>
#include <sys/types.h>

#if !defined(_POSIX_VERSION) || _POSIX_VERSION < 200809L
size_t strnlen(const char* s, size_t maxlen) {
const char* end;
end = memchr(s, '\0', maxlen);
if (end == NULL)
return maxlen;
return end - s;
}
#endif

#include "../readstat.h"
#include "../readstat_bits.h"
#include "../readstat_iconv.h"
Expand Down

0 comments on commit 4a878a1

Please sign in to comment.