diff options
Diffstat (limited to 'gl/xsize.h')
| -rw-r--r-- | gl/xsize.h | 20 |
1 files changed, 16 insertions, 4 deletions
| @@ -1,6 +1,6 @@ | |||
| 1 | /* xsize.h -- Checked size_t computations. | 1 | /* xsize.h -- Checked size_t computations. |
| 2 | 2 | ||
| 3 | Copyright (C) 2003, 2008-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2003, 2008-2024 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
| @@ -18,6 +18,11 @@ | |||
| 18 | #ifndef _XSIZE_H | 18 | #ifndef _XSIZE_H |
| 19 | #define _XSIZE_H | 19 | #define _XSIZE_H |
| 20 | 20 | ||
| 21 | /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, HAVE_STDINT_H. */ | ||
| 22 | #if !_GL_CONFIG_H_INCLUDED | ||
| 23 | #error "Please include config.h first." | ||
| 24 | #endif | ||
| 25 | |||
| 21 | /* Get size_t. */ | 26 | /* Get size_t. */ |
| 22 | #include <stddef.h> | 27 | #include <stddef.h> |
| 23 | 28 | ||
| @@ -30,14 +35,16 @@ | |||
| 30 | /* Get ATTRIBUTE_PURE. */ | 35 | /* Get ATTRIBUTE_PURE. */ |
| 31 | #include "attribute.h" | 36 | #include "attribute.h" |
| 32 | 37 | ||
| 33 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
| 34 | #error "Please include config.h first." | ||
| 35 | #endif | ||
| 36 | _GL_INLINE_HEADER_BEGIN | 38 | _GL_INLINE_HEADER_BEGIN |
| 37 | #ifndef XSIZE_INLINE | 39 | #ifndef XSIZE_INLINE |
| 38 | # define XSIZE_INLINE _GL_INLINE | 40 | # define XSIZE_INLINE _GL_INLINE |
| 39 | #endif | 41 | #endif |
| 40 | 42 | ||
| 43 | #ifdef __cplusplus | ||
| 44 | extern "C" { | ||
| 45 | #endif | ||
| 46 | |||
| 47 | |||
| 41 | /* The size of memory objects is often computed through expressions of | 48 | /* The size of memory objects is often computed through expressions of |
| 42 | type size_t. Example: | 49 | type size_t. Example: |
| 43 | void* p = malloc (header_size + n * element_size). | 50 | void* p = malloc (header_size + n * element_size). |
| @@ -103,6 +110,11 @@ xmax (size_t size1, size_t size2) | |||
| 103 | #define size_in_bounds_p(SIZE) \ | 110 | #define size_in_bounds_p(SIZE) \ |
| 104 | ((SIZE) != SIZE_MAX) | 111 | ((SIZE) != SIZE_MAX) |
| 105 | 112 | ||
| 113 | |||
| 114 | #ifdef __cplusplus | ||
| 115 | } | ||
| 116 | #endif | ||
| 117 | |||
| 106 | _GL_INLINE_HEADER_END | 118 | _GL_INLINE_HEADER_END |
| 107 | 119 | ||
| 108 | #endif /* _XSIZE_H */ | 120 | #endif /* _XSIZE_H */ |
