Skip to content

Commit

Permalink
Reorganization of C and POSIX headers in H5public.h & H5private.h (#793)
Browse files Browse the repository at this point in the history
* Reorganization of C and POSIX headers in H5public.h & H5private.h

Consolidated and removed duplicates

* It turns out Windows has sys/types.h

Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
  • Loading branch information
derobins and lrknox authored Jun 24, 2021
1 parent 5c3f4b3 commit b16b731
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
7 changes: 3 additions & 4 deletions src/H5private.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@
#include <errno.h>
#include <fcntl.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

/* POSIX headers */
#ifdef H5_HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef H5_HAVE_UNISTD_H
#include <pwd.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#endif

Expand Down
26 changes: 13 additions & 13 deletions src/H5public.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,23 @@
#include <features.h> /* For setting POSIX, BSD, etc. compatibility */
#endif

#ifdef H5_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

#include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */
#include <stdarg.h> /* For variadic functions in H5VLpublic.h */

#include <stdint.h> /* For C9x types */

/* C library header files for things that appear in HDF5 public headers */
#ifdef __cplusplus
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */

#ifdef H5_HAVE_STDDEF_H
#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

/* Unlike most sys/ headers, which are POSIX-only, sys/types.h is avaible
* on Windows, though it doesn't necessarily contain all the POSIX types
* we need for HDF5 (e.g. ssize_t).
*/
#ifdef H5_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

#ifdef H5_HAVE_PARALLEL
Expand Down Expand Up @@ -192,7 +193,6 @@ typedef int herr_t;
* }
* \endcode
*/
#include <stdbool.h>
typedef bool hbool_t;
typedef int htri_t;

Expand Down

0 comments on commit b16b731

Please sign in to comment.