From 640f82dde11f89e15b708422e5e5514c95707cbb Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Tue, 14 Nov 2017 12:35:35 -0700 Subject: [PATCH] Clean-up before merge --- src/scheduler.c | 4 ++-- src/tools.c | 15 --------------- src/tools.h | 2 -- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/scheduler.c b/src/scheduler.c index 1eaea2a68e..940e55b84b 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -50,7 +50,6 @@ #include "space.h" #include "task.h" #include "timers.h" -#include "tools.h" #include "version.h" /** @@ -146,7 +145,8 @@ void scheduler_write_dependencies(struct scheduler *s, int verbose) { /* Create file */ char filename[200] = "dependency_graph.dot"; - FILE *f = open_and_check_file(filename, "w"); + FILE *f = fopen(filename, "w"); + if (f == NULL) error("Error opening depenency graph file."); /* Write header */ fprintf(f, "digraph task_dep {\n"); diff --git a/src/tools.c b/src/tools.c index 1aedfc7c35..89d89e62ea 100644 --- a/src/tools.c +++ b/src/tools.c @@ -23,7 +23,6 @@ #include "../config.h" /* Some standard headers. */ -#include <errno.h> #include <math.h> #include <stddef.h> #include <stdio.h> @@ -695,17 +694,3 @@ int compare_particles(struct part a, struct part b, double threshold) { #endif } - -/** - * @brief Open a file and verify if it was correctly opened - * - * @param filename Name of the file - * @param mode Opening mode (e.g. 'a', 'w', ..) - */ -FILE *open_and_check_file(const char *filename, const char *mode) { - FILE *f = fopen(filename, mode); - if (f == NULL) - error("Unable to open file '%s' in mode %s, error: %i", filename, mode, - errno); - return f; -} diff --git a/src/tools.h b/src/tools.h index 3a5f822920..4d9e8d3ef8 100644 --- a/src/tools.h +++ b/src/tools.h @@ -52,6 +52,4 @@ int compare_values(double a, double b, double threshold, double *absDiff, double *absSum, double *relDiff); int compare_particles(struct part a, struct part b, double threshold); -FILE *open_and_check_file(const char *filename, const char *mode); - #endif /* SWIFT_TOOL_H */ -- GitLab