From 95d2bbf3930c39116fe0bee78ed6feb734c38b0a Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Fri, 16 Aug 2019 17:47:08 -0400 Subject: Switched to reading whole file into memory; started number literals --- util/files.c | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 util/files.c (limited to 'util/files.c') diff --git a/util/files.c b/util/files.c deleted file mode 100644 index 0afa843..0000000 --- a/util/files.c +++ /dev/null @@ -1,28 +0,0 @@ -static int fpeekc(FILE *fp) { - int c = getc(fp); - if (c == EOF) - return c; - ungetc(c, fp); - return c; -} - -#define fnextc getc /* advance to the next character */ - -/* NOTE: Advances and returns # of characters advanced iff prefix is found. */ -static int fhasprefix(FILE *fp, const char *prefix) { - assert(*prefix); - long start = ftell(fp); - if (start == -1) - return 0; - const char *p = prefix; - while (*p) { - int c = getc(fp); - if (c != *p) { - /* wrong character / EOF */ - fseek(fp, start, SEEK_SET); - return 0; - } - p++; - } - return (int)(p - prefix); /* length of prefix */ -} -- cgit v1.2.3