fix lua cflags
[openwrt.git] / tools / genext2fs / patches / 01-remove_getline.patch
1 diff -urN genext2fs-1.4rc1/genext2fs.c genext2fs-1.4rc1.new/genext2fs.c
2 --- genext2fs-1.4rc1/genext2fs.c 2005-05-17 18:29:10.000000000 +0200
3 +++ genext2fs-1.4rc1.new/genext2fs.c 2007-01-03 15:21:16.000000000 +0100
4 @@ -243,48 +243,6 @@
5 }
6 #endif // defined SNPRINTF_STORAGE_CLASS
7
8 -#if defined(__APPLE__) && defined(__GNUC__)
9 -// getline() replacement for Darwin, might work on other systems
10 -// written according to the getline man page included with Debian Linux
11 -ssize_t
12 -getline(char **lineptr, size_t *n, FILE *stream)
13 -{
14 - char *buf = *lineptr; // could be NULL, in which case we allocate
15 - size_t bufsize = *n; // current buffer size, adjust if we (re)alloc
16 -
17 - char *temp = NULL;
18 - size_t tempsize = 0;
19 -
20 - // temp is not a C string and we don't own the buffer it points into
21 - // must copy into a malloced buffer and NULL terminate
22 - temp = fgetln(stream, &tempsize);
23 - if(!temp) return -1;
24 -
25 - tempsize++; // adjust for NULL terminator
26 - if(buf) {
27 - // check if we have to reallocate
28 - if(bufsize < tempsize) {
29 - bufsize = tempsize;
30 - buf = (char*)realloc(buf, tempsize);
31 - if(!buf) return -1;
32 - }
33 - } else {
34 - bufsize = tempsize;
35 - buf = (char*)malloc(bufsize);
36 - if(!buf) return -1;
37 - }
38 -
39 - memcpy(buf, temp, tempsize-1);
40 - buf[tempsize-1] = '\0';
41 -
42 - // give new pointer and size back, nondestructive if we didn't change anything..
43 - *n = bufsize;
44 - *lineptr = buf;
45 -
46 - return (ssize_t)(tempsize-1); // don't include the NULL terminator, per getline man page
47 -}
48 -#endif
49 -
50 // Convert a numerical string to a float, and multiply the result by an
51 // SI-style multiplier if provided; supported multipliers are Ki, Mi, Gi, k, M
52 // and G.
This page took 0.063943 seconds and 5 git commands to generate.