| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef MUJOCO_SRC_ENGINE_ENGINE_ARRAY_SAFETY_H_ |
| | #define MUJOCO_SRC_ENGINE_ENGINE_ARRAY_SAFETY_H_ |
| |
|
| | #ifdef __cplusplus |
| | #error This file should not be used from C++ code. |
| | #endif |
| |
|
| | #include <stdio.h> |
| | #include <string.h> |
| |
|
| | |
| | |
| | #define mjSIZEOFARRAY(arr) _Generic(&(arr), char(*)[sizeof(arr)]: sizeof(arr)) |
| |
|
| | #define mjSNPRINTF(dest, ...) snprintf(dest, mjSIZEOFARRAY(dest), __VA_ARGS__) |
| |
|
| | #define mjSTRNCAT(dest, src) strncat(dest, src, mjSIZEOFARRAY(dest) - strlen(dest) - 1) |
| |
|
| | #define mjSTRNCPY(dest, src) mju_strncpy(dest, src, mjSIZEOFARRAY(dest)) |
| |
|
| | #endif |
| |
|