diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2020-03-09 19:00:14 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2020-03-09 19:24:26 +0530 |
commit | adc613d8011af7c508050badb1272e8326554c39 (patch) | |
tree | 4eadedc0767e1f4f482b7c22ec905329acab62a6 /app/tools/ndk-compat | |
parent | fd573f6c1c37bcfcd09237dfcd55e08b1e0eaff9 (diff) |
Migrate tunnel related classes to tunnel/ Gradle module
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/tools/ndk-compat')
-rw-r--r-- | app/tools/ndk-compat/compat.c | 77 | ||||
-rw-r--r-- | app/tools/ndk-compat/compat.h | 16 |
2 files changed, 0 insertions, 93 deletions
diff --git a/app/tools/ndk-compat/compat.c b/app/tools/ndk-compat/compat.c deleted file mode 100644 index 7cc99fc4..00000000 --- a/app/tools/ndk-compat/compat.c +++ /dev/null @@ -1,77 +0,0 @@ -/* SPDX-License-Identifier: BSD - * - * Copyright © 2017-2019 WireGuard LLC. All Rights Reserved. - * - */ - -#define FILE_IS_EMPTY - -#if defined(__ANDROID_API__) && __ANDROID_API__ < 18 -#undef FILE_IS_EMPTY -#include <stdio.h> -#include <stdlib.h> - -ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp) -{ - char *ptr, *eptr; - - if (*buf == NULL || *bufsiz == 0) { - *bufsiz = BUFSIZ; - if ((*buf = malloc(*bufsiz)) == NULL) - return -1; - } - - for (ptr = *buf, eptr = *buf + *bufsiz;;) { - int c = fgetc(fp); - if (c == -1) { - if (feof(fp)) { - ssize_t diff = (ssize_t)(ptr - *buf); - if (diff != 0) { - *ptr = '\0'; - return diff; - } - } - return -1; - } - *ptr++ = c; - if (c == delimiter) { - *ptr = '\0'; - return ptr - *buf; - } - if (ptr + 2 >= eptr) { - char *nbuf; - size_t nbufsiz = *bufsiz * 2; - ssize_t d = ptr - *buf; - if ((nbuf = realloc(*buf, nbufsiz)) == NULL) - return -1; - *buf = nbuf; - *bufsiz = nbufsiz; - eptr = nbuf + nbufsiz; - ptr = nbuf + d; - } - } -} - -ssize_t getline(char **buf, size_t *bufsiz, FILE *fp) -{ - return getdelim(buf, bufsiz, '\n', fp); -} -#endif - -#if defined(__ANDROID_API__) && __ANDROID_API__ < 24 -#undef FILE_IS_EMPTY -#include <string.h> - -char *strchrnul(const char *s, int c) -{ - char *x = strchr(s, c); - if (!x) - return (char *)s + strlen(s); - return x; -} -#endif - -#ifdef FILE_IS_EMPTY -#undef FILE_IS_EMPTY -static char ____x __attribute__((unused)); -#endif diff --git a/app/tools/ndk-compat/compat.h b/app/tools/ndk-compat/compat.h deleted file mode 100644 index 52f6c127..00000000 --- a/app/tools/ndk-compat/compat.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: BSD - * - * Copyright © 2017-2019 WireGuard LLC. All Rights Reserved. - * - */ - -#if defined(__ANDROID_API__) && __ANDROID_API__ < 18 -#include <stdio.h> -ssize_t getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp); -ssize_t getline(char **buf, size_t *bufsiz, FILE *fp); -#endif - -#if defined(__ANDROID_API__) && __ANDROID_API__ < 24 -char *strchrnul(const char *s, int c); -#endif - |