create meminfo in memory
Sat Feb 21 12:08:59 CET 2009 tobias@rautenkranz.ch
* create meminfo in memory
hunk ./Makefile 23
- rm -f -- test/*.o test/fopen-cat
+ rm -f -- tests/*.o tests/fopen-cat
hunk ./README 1
-Myth2 for Linux parses /proc/meminfo,
+Myth2 (1.3e) for Linux parses /proc/meminfo,
hunk ./README 4
+It should also fix the cut scenes crash.
hunk ./README 19
+
+Contact:
+ tobias@rautenkranz.ch
hunk ./fopenRedirect.c 26
+#define _GNU_SOURCE
hunk ./fopenRedirect.c 28
-
-#define __USE_GNU
hunk ./fopenRedirect.c 29
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
hunk ./fopenRedirect.c 32
-static const char meminfo_str[] = [_$_]
+static char meminfo_str[] = [_$_]
hunk ./fopenRedirect.c 37
-int tmp_meminfo = -1;
-
-/** Returns a stream to an meminfo file. */
hunk ./fopenRedirect.c 38
-make_meminfo()
-{
- FILE* tmp_meminfo = tmpfile();
-
- if (!tmp_meminfo)
- {
- perror("myth-meminfo: creating temponary meminfo");
- return NULL;
- }
-
- size_t len = fwrite(meminfo_str, 1, sizeof(meminfo_str), tmp_meminfo);
- if (len != sizeof(meminfo_str))
- {
- perror("myth-meminfo: writing temporary meminfo");
- return NULL;
- }
-
- rewind(tmp_meminfo);
-
- return tmp_meminfo;
-}
-
-FILE* fopen(const char *filename, const char *mode)
+fopen(const char *filename, const char *mode)
hunk ./fopenRedirect.c 41
+
hunk ./fopenRedirect.c 52
- return make_meminfo();
+ return fmemopen(meminfo_str, sizeof(meminfo_str), mode);
changepref test
make test