file-handle-def.h (fh_ref): Add WARN_UNUSED_RESULT qualifier
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 14 Jun 2020 15:42:45 +0000 (17:42 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 14 Jun 2020 16:32:04 +0000 (18:32 +0200)
src/data/file-handle-def.c
src/data/file-handle-def.h

index 4546a9ca0c4a137571878b2dab9086d4b63134c0..1296a5b171ab342b9985d47d8c04ef6dff21d021 100644 (file)
@@ -409,7 +409,7 @@ fh_set_default_handle (struct file_handle *new_default_handle)
     fh_unref (default_handle);
   default_handle = new_default_handle;
   if (default_handle != NULL)
-    fh_ref (default_handle);
+    default_handle = fh_ref (default_handle);
 }
 \f
 /* Information about a file handle's readers or writers. */
index af40c7ab3763c6582e856d81c4f6485412a98dae..2f944ed1c29803cb11e975ee9401d63b660b24cc 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef FILE_HANDLE_DEF_H
 #define FILE_HANDLE_DEF_H
 
+#include "libpspp/compiler.h"
 #include <stdbool.h>
 #include <stddef.h>
 
@@ -81,7 +82,7 @@ struct file_handle *fh_create_dataset (struct dataset *);
 const struct fh_properties *fh_default_properties (void);
 
 /* Reference management. */
-struct file_handle *fh_ref (struct file_handle *);
+struct file_handle *fh_ref (struct file_handle *) WARN_UNUSED_RESULT;
 void fh_unref (struct file_handle *);
 void fh_unname (struct file_handle *);