Remove fmemopen

This commit is contained in:
Neale Pickett 2012-05-10 12:08:41 -06:00
parent d63e957ee3
commit 9f2749512f
2 changed files with 11 additions and 14 deletions

12
eris.c
View File

@ -550,10 +550,11 @@ handle_request()
/* Interpret path into fspath. */
path = p - 1;
{
FILE *f = fmemopen(fspath, sizeof fspath, "w");
char *fsp = fspath;
char *query_string = NULL;
fprintf(f, "./");
*(fsp++) = '.';
*(fsp++) = '/';
for (; *p != ' '; p += 1) {
if (! query_string) {
char c = *p;
@ -584,11 +585,12 @@ handle_request()
break;
}
fputc(c, f);
if (fsp - fspath + 1 < sizeof fspath) {
*(fsp++) = c;
}
}
}
fputc(0, f);
fclose(f);
*fsp = 0;
*(p++) = 0; /* NULL-terminate path */

View File

@ -116,15 +116,10 @@ void
url_esc(FILE *f, char *s)
{
for (; *s; s += 1) {
switch (*s) {
case '%':
case 127:
case -127 ... 31:
fprintf(f, "%%%02x", *s);
break;
default:
fputc(*s, f);
break;
if ((*s == '%') || (*s == 127) || (*s < 31)) {
fprintf(f, "%%%02x", *s);
} else {
fputc(*s, f);
}
}
}