X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeutil.h;h=44abe1a6aa589e9167db6fe572e523ada198a9c2;hb=4ca59cb404899ecc345f6eb30d82a623a346b6fe;hp=15dcebd31959ffe98922aad302be59760e533fb8;hpb=111503924bac361d3db429f4bdd30532165a1652;p=libfirm diff --git a/ir/be/beutil.h b/ir/be/beutil.h index 15dcebd31..44abe1a6a 100644 --- a/ir/be/beutil.h +++ b/ir/be/beutil.h @@ -53,4 +53,18 @@ void localize_consts(ir_graph *irg); */ void dump_allocated_irg(ir_graph *irg, char *suffix); + + +static INLINE FILE *ffopen(const char *base, const char *ext, const char *mode) { + FILE *out; + char buf[1024]; + + snprintf(buf, sizeof(buf), "%s.%s", base, ext); + if (! (out = fopen(buf, mode))) { + fprintf(stderr, "Cannot open file %s in mode %s\n", buf, mode); + return NULL; + } + return out; +} + #endif