Remove now unused fgets_unlimited
This commit is contained in:
parent
a899b9b945
commit
eb84a067fa
|
@ -2,13 +2,10 @@
|
||||||
#ifndef _STRIO_H
|
#ifndef _STRIO_H
|
||||||
#define _STRIO_H
|
#define _STRIO_H
|
||||||
|
|
||||||
#include <physfs.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char* fgets_unlimited(PHYSFS_file *f);
|
|
||||||
char *splitword(char *s, char splitchar);
|
char *splitword(char *s, char splitchar);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -5,33 +5,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "physfsx.h"
|
|
||||||
#include "strio.h"
|
#include "strio.h"
|
||||||
#include "u_mem.h"
|
#include "u_mem.h"
|
||||||
|
|
||||||
char *fgets_unlimited(PHYSFS_file *f)
|
|
||||||
{
|
|
||||||
int mem = 256;
|
|
||||||
char *word, *buf, *p;
|
|
||||||
|
|
||||||
MALLOC(word, char, mem);
|
|
||||||
p = word;
|
|
||||||
|
|
||||||
while (word && PHYSFSX_fgets(p, mem, f) == word + mem) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// Make a bigger buffer, because it read to the end of the buffer.
|
|
||||||
buf = word;
|
|
||||||
mem *= 2;
|
|
||||||
MALLOC(word, char, mem);
|
|
||||||
for (i = 0; i < mem/2; i++)
|
|
||||||
word[i] = buf[i];
|
|
||||||
d_free(buf);
|
|
||||||
p = word + mem/2;
|
|
||||||
}
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* splitword(char *s, char splitchar)
|
char* splitword(char *s, char splitchar)
|
||||||
{
|
{
|
||||||
int x,l,l2;
|
int x,l,l2;
|
||||||
|
|
Loading…
Reference in a new issue