File tree Expand file tree Collapse file tree 2 files changed +0
-58
lines changed Expand file tree Collapse file tree 2 files changed +0
-58
lines changed Original file line number Diff line number Diff line change 6
6
7
7
#define FILE_IS_EMPTY
8
8
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
-
61
9
#if defined(__ANDROID_MIN_SDK_VERSION__ ) && __ANDROID_MIN_SDK_VERSION__ < 24
62
10
#undef FILE_IS_EMPTY
63
11
#include <string.h>
Original file line number Diff line number Diff line change 4
4
*
5
5
*/
6
6
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
-
13
7
#if defined(__ANDROID_MIN_SDK_VERSION__ ) && __ANDROID_MIN_SDK_VERSION__ < 24
14
8
char * strchrnul (const char * s , int c );
15
9
#endif
You can’t perform that action at this time.
0 commit comments