From 1b4a75fdf792b0dbb68bece4f556e14d212a4acb Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Thu, 21 Sep 2017 14:31:44 +0200
Subject: [PATCH] Code formatting, comments style and correct type for the
 returned value of H5Lexists().

---
 examples/main.c |  3 ++-
 src/common_io.c | 11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/examples/main.c b/examples/main.c
index 6a7641dadc..56f463940d 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -325,7 +325,8 @@ int main(int argc, char *argv[]) {
 
 /* Let's pin the main thread, now we know if affinity will be used. */
 #if defined(HAVE_SETAFFINITY) && defined(HAVE_LIBNUMA) && defined(_GNU_SOURCE)
-  if (with_aff && ((ENGINE_POLICY)&engine_policy_setaffinity) == engine_policy_setaffinity)
+  if (with_aff &&
+      ((ENGINE_POLICY)&engine_policy_setaffinity) == engine_policy_setaffinity)
     engine_pin();
 #endif
 
diff --git a/src/common_io.c b/src/common_io.c
index 22c8ebb6d0..3bf0b91cb6 100644
--- a/src/common_io.c
+++ b/src/common_io.c
@@ -299,8 +299,9 @@ void io_write_attribute_s(hid_t grp, const char* name, const char* str) {
  * If the 'Units' group does not exist in the ICs, cgs units will be assumed
  */
 void io_read_unit_system(hid_t h_file, struct unit_system* us) {
-  // First check if it exists as this is *not* required.
-  int exists = H5Lexists(h_file, "/Units", H5P_DEFAULT);
+
+  /* First check if it exists as this is *not* required. */
+  const htri_t exists = H5Lexists(h_file, "/Units", H5P_DEFAULT);
 
   if (exists == 0) {
     message("'Units' group not found in ICs. Assuming CGS unit system.");
@@ -314,11 +315,11 @@ void io_read_unit_system(hid_t h_file, struct unit_system* us) {
 
     return;
   } else if (exists < 0) {
-    error("Serious problem with 'Units' group in your ICs. H5Lexists gives %d",
+    error("Serious problem with 'Units' group your ICs. H5Lexists gives %d",
           exists);
   }
-  
-  message("Reading units from your ICs.");
+
+  message("Reading IC units from ICs.");
   hid_t h_grp = H5Gopen(h_file, "/Units", H5P_DEFAULT);
 
   /* Ok, Read the damn thing */
-- 
GitLab