Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:47:27

0001 /*
0002  * Copyright (c) 2016-2020 Intel, Inc.  All rights reserved.
0003  * Copyright (c) 2021      Nanook Consulting.  All rights reserved.
0004  * $COPYRIGHT$
0005  *
0006  * Additional copyrights may follow
0007  *
0008  * $HEADER$
0009  */
0010 
0011 /** @file
0012  *
0013  * Buffer strnlen function for portability to archaic platforms.
0014  */
0015 
0016 #ifndef PMIX_STRNLEN_H
0017 #define PMIX_STRNLEN_H
0018 
0019 #include "src/include/pmix_config.h"
0020 
0021 #if defined(HAVE_STRNLEN)
0022 #    define PMIX_STRNLEN(c, a, b) (c) = strnlen(a, b)
0023 #else
0024 #    define PMIX_STRNLEN(c, a, b)          \
0025         do {                               \
0026             size_t _x;                     \
0027             (c) = 0;                       \
0028             for (_x = 0; _x < (b); _x++) { \
0029                 if ('\0' == (a)[_x]) {     \
0030                     break;                 \
0031                 }                          \
0032                 ++(c);                     \
0033             }                              \
0034         } while (0)
0035 #endif
0036 
0037 #endif /* PMIX_STRNLEN_H */