From f8c26358f0b87a9c90be3f038cdea5bdcae185a0 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Wed, 6 Apr 2016 14:28:45 -0700 Subject: Changes for PR comments. --- tests/test_def.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'tests/test_def.c') diff --git a/tests/test_def.c b/tests/test_def.c index 6f3fb8f..cc766e0 100644 --- a/tests/test_def.c +++ b/tests/test_def.c @@ -3,6 +3,7 @@ ** (like attempts to link defs that don't have required properties set). */ +#include "tests/test_util.h" #include "upb/def.h" #include "upb/pb/glue.h" #include "upb_test.h" @@ -38,26 +39,6 @@ static void test_noreftracking() { upb_msgdef_unref(md, &md); } -static char *upb_readfile(const char *filename, size_t *len) { - long size; - char *buf; - FILE *f = fopen(filename, "rb"); - if(!f) return NULL; - if(fseek(f, 0, SEEK_END) != 0) goto error; - size = ftell(f); - if(size < 0) goto error; - if(fseek(f, 0, SEEK_SET) != 0) goto error; - buf = malloc(size + 1); - if(size && fread(buf, size, 1, f) != 1) goto error; - fclose(f); - if (len) *len = size; - return buf; - -error: - fclose(f); - return NULL; -} - static upb_symtab *load_test_proto(void *owner) { upb_symtab *s = upb_symtab_new(owner); upb_status status = UPB_STATUS_INIT; -- cgit v1.2.3