Skip to content

Commit 23d083a

Browse files
committed
tools: ndk-compat: NDK now is minimum API 19
Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent b1d9d35 commit 23d083a

File tree

2 files changed

+0
-58
lines changed

2 files changed

+0
-58
lines changed

tunnel/tools/ndk-compat/compat.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,6 @@
66

77
#define FILE_IS_EMPTY
88

9-
#if defined(__ANDROID_MIN_SDK_VERSION__) && __ANDROID_MIN_SDK_VERSION__ < 18
10-
#undef FILE_IS_EMPTY
11-
#include <stdio.h>
12-
#include <stdlib.h>
13-
14-
ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
15-
{
16-
char *ptr, *eptr;
17-
18-
if (*buf == NULL || *bufsiz == 0) {
19-
*bufsiz = BUFSIZ;
20-
if ((*buf = malloc(*bufsiz)) == NULL)
21-
return -1;
22-
}
23-
24-
for (ptr = *buf, eptr = *buf + *bufsiz;;) {
25-
int c = fgetc(fp);
26-
if (c == -1) {
27-
if (feof(fp)) {
28-
ssize_t diff = (ssize_t)(ptr - *buf);
29-
if (diff != 0) {
30-
*ptr = '\0';
31-
return diff;
32-
}
33-
}
34-
return -1;
35-
}
36-
*ptr++ = c;
37-
if (c == delimiter) {
38-
*ptr = '\0';
39-
return ptr - *buf;
40-
}
41-
if (ptr + 2 >= eptr) {
42-
char *nbuf;
43-
size_t nbufsiz = *bufsiz * 2;
44-
ssize_t d = ptr - *buf;
45-
if ((nbuf = realloc(*buf, nbufsiz)) == NULL)
46-
return -1;
47-
*buf = nbuf;
48-
*bufsiz = nbufsiz;
49-
eptr = nbuf + nbufsiz;
50-
ptr = nbuf + d;
51-
}
52-
}
53-
}
54-
55-
ssize_t getline(char **buf, size_t *bufsiz, FILE *fp)
56-
{
57-
return getdelim(buf, bufsiz, '\n', fp);
58-
}
59-
#endif
60-
619
#if defined(__ANDROID_MIN_SDK_VERSION__) && __ANDROID_MIN_SDK_VERSION__ < 24
6210
#undef FILE_IS_EMPTY
6311
#include <string.h>

tunnel/tools/ndk-compat/compat.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
*
55
*/
66

7-
#if defined(__ANDROID_MIN_SDK_VERSION__) && __ANDROID_MIN_SDK_VERSION__ < 18
8-
#include <stdio.h>
9-
ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp);
10-
ssize_t getline(char **buf, size_t *bufsiz, FILE *fp);
11-
#endif
12-
137
#if defined(__ANDROID_MIN_SDK_VERSION__) && __ANDROID_MIN_SDK_VERSION__ < 24
148
char *strchrnul(const char *s, int c);
159
#endif

0 commit comments

Comments
 (0)