diff options
Diffstat (limited to 'src/upb_string.c')
-rw-r--r-- | src/upb_string.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/upb_string.c b/src/upb_string.c deleted file mode 100644 index 54df4f1..0000000 --- a/src/upb_string.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Joshua Haberman. See LICENSE for details. - */ - -#include <stdio.h> -#include "upb_string.h" - -struct upb_string *upb_strreadfile(const char *filename) { - FILE *f = fopen(filename, "rb"); - if(!f) return false; - if(fseek(f, 0, SEEK_END) != 0) goto error; - long size = ftell(f); - if(size < 0) goto error; - if(fseek(f, 0, SEEK_SET) != 0) goto error; - struct upb_string *s = upb_string_new(); - upb_string_resize(s, size); - if(fread(s->ptr, size, 1, f) != 1) goto error; - fclose(f); - return s; - -error: - fclose(f); - return NULL; -} |