summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-08-16 17:47:08 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-08-16 17:47:08 -0400
commit95d2bbf3930c39116fe0bee78ed6feb734c38b0a (patch)
treee421f18ddc0ef48770a7b52c6b9c7e4d35635589 /util
parent54097d6dbd03ee483034dee39f669afd9333aeb1 (diff)
Switched to reading whole file into memory; started number literals
Diffstat (limited to 'util')
-rw-r--r--util/err.c1
-rw-r--r--util/files.c28
2 files changed, 1 insertions, 28 deletions
diff --git a/util/err.c b/util/err.c
index 7a38017..89a1335 100644
--- a/util/err.c
+++ b/util/err.c
@@ -7,6 +7,7 @@ static void err_print(LineNo line, LineNo col, const char *fmt, ...) {
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
+ fprintf(stderr, "\n");
}
static void *err_malloc(size_t size) {
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 */
-}