Commit 25e36f01 authored by Chris Friedt's avatar Chris Friedt Committed by Benjamin Cabé
Browse files

posix: limits: de-duplicate limit logic



Rather than duplicating limit logic in several places, de-duplicate it
and centralize preprocessor checks in posix_limits.h .

Signed-off-by: default avatarChris Friedt <cfriedt@tenstorrent.com>
parent ca2e0699
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
#ifndef ZEPHYR_INCLUDE_ZEPHYR_POSIX_POSIX_LIMITS_H_
#define ZEPHYR_INCLUDE_ZEPHYR_POSIX_POSIX_LIMITS_H_

#if defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)

/*
 * clang-format and checkpatch disagree on formatting here, so rely on checkpatch and disable
 * clang-format since checkpatch cannot be selectively disabled.
@@ -122,4 +124,6 @@

/* clang-format on */

#endif

#endif /* ZEPHYR_INCLUDE_ZEPHYR_POSIX_POSIX_LIMITS_H_ */
+2 −15
Original line number Diff line number Diff line
@@ -8,23 +8,10 @@
#define LIB_LIBC_ARCMWDT_INCLUDE_LIMITS_H_

#include_next <limits.h>

#ifdef __cplusplus
extern "C" {
#endif

#if defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)

#include <zephyr/posix/posix_limits.h>

#else

#ifndef PATH_MAX
#define PATH_MAX 256

#endif

#ifdef __cplusplus
}
#endif

#endif  /* ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_LIMITS_H_ */
#endif  /* LIB_LIBC_ARCMWDT_INCLUDE_LIMITS_H_ */
+1 −14
Original line number Diff line number Diff line
@@ -8,23 +8,10 @@
#define ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_LIMITS_H_

#include_next <limits.h>

#ifdef __cplusplus
extern "C" {
#endif

#if defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)

#include <zephyr/posix/posix_limits.h>

#else

#ifndef PATH_MAX
#define PATH_MAX 256

#endif

#ifdef __cplusplus
}
#endif

#endif  /* ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_LIMITS_H_ */
+1 −14
Original line number Diff line number Diff line
@@ -8,23 +8,10 @@
#define ZEPHYR_LIB_LIBC_IAR_INCLUDE_LIMITS_H_

#include_next <limits.h>

#ifdef __cplusplus
extern "C" {
#endif

#if defined(_POSIX_C_SOURCE) || defined(__DOXYGEN__)

#include <zephyr/posix/posix_limits.h>

#else

#ifndef PATH_MAX
#define PATH_MAX 256

#endif

#ifdef __cplusplus
}
#endif

#endif /* ZEPHYR_LIB_LIBC_IAR_INCLUDE_LIMITS_H_ */