Change MuJoCo engine source code function-spacing convention from 3 blank lines to 2

PiperOrigin-RevId: 813754244
Change-Id: I6836e41c3b021cb727e922c25c60f629b9814c93
This commit is contained in:
Yuval Tassa
2025-10-01 07:57:17 -07:00
committed by Copybara-Service
parent c439628f82
commit edbdb5195c
36 changed files with 8 additions and 651 deletions
-31
View File
@@ -53,7 +53,6 @@ static const int MAX_ARRAY_SIZE = INT_MAX / 4;
//----------------------------------- static utility functions -------------------------------------
//----------------------------------- static utility functions -------------------------------------
// id used to identify binary mjModel file/buffer
@@ -80,7 +79,6 @@ static int getnint(void) {
}
// count buffer members in mjModel (mjtSize)
static int getnbuffer(void) {
int cnt = 0;
@@ -93,7 +91,6 @@ static int getnbuffer(void) {
}
// count pointers in mjModel
static int getnptr(void) {
int cnt = 0;
@@ -106,7 +103,6 @@ static int getnptr(void) {
}
// write to memory buffer
static void bufwrite(const void* src, int num, int szbuf, void* buf, int* ptrbuf) {
// check pointers
@@ -125,7 +121,6 @@ static void bufwrite(const void* src, int num, int szbuf, void* buf, int* ptrbuf
}
// read from memory buffer
static void bufread(void* dest, int num, int szbuf, const void* buf, int* ptrbuf) {
// check pointers
@@ -144,7 +139,6 @@ static void bufread(void* dest, int num, int szbuf, const void* buf, int* ptrbuf
}
// number of bytes to be skipped to achieve 64-byte alignment
static inline unsigned int SKIP(intptr_t offset) {
const unsigned int align = 64;
@@ -153,7 +147,6 @@ static inline unsigned int SKIP(intptr_t offset) {
}
//----------------------------------- mjModel construction -----------------------------------------
// set pointers in mjModel buffer
@@ -183,7 +176,6 @@ static void mj_setPtrModel(mjModel* m) {
}
// increases buffer size without causing integer overflow, returns 0 if
// operation would cause overflow
// performs the following operations:
@@ -213,14 +205,12 @@ static int safeAddToBufferSize(intptr_t* offset, mjtSize* nbuffer,
}
// free model memory without destroying the struct
static void freeModelBuffers(mjModel* m) {
mju_free(m->buffer);
}
// allocate and initialize mjModel structure
void mj_makeModel(mjModel** dest,
int nq, int nv, int nu, int na, int nbody, int nbvh,
@@ -403,7 +393,6 @@ void mj_makeModel(mjModel** dest,
}
// copy mjModel, if dest==NULL create new model
mjModel* mj_copyModel(mjModel* dest, const mjModel* src) {
// allocate new model if needed
@@ -456,7 +445,6 @@ mjModel* mj_copyModel(mjModel* dest, const mjModel* src) {
}
// copy mjModel, skip large arrays not required for abstract visualization
void mjv_copyModel(mjModel* dest, const mjModel* src) {
// check sizes
@@ -488,7 +476,6 @@ void mjv_copyModel(mjModel* dest, const mjModel* src) {
}
// save model to binary file, or memory buffer of szbuf>0
void mj_saveModel(const mjModel* m, const char* filename, void* buffer, int buffer_sz) {
FILE* fp = 0;
@@ -680,7 +667,6 @@ void mj_deleteModel(mjModel* m) {
}
// size of buffer needed to hold model
int mj_sizeModel(const mjModel* m) {
int size = (
@@ -700,8 +686,6 @@ int mj_sizeModel(const mjModel* m) {
}
//-------------------------- sparse system matrix construction -------------------------------------
// construct sparse representation of dof-dof matrix
@@ -878,7 +862,6 @@ void mj_makeBSparse(int nv, int nbody, int nB,
}
// check D and B sparsity for consistency
static void checkDBSparse(const mjModel* m) {
// process all dofs
@@ -899,7 +882,6 @@ static void checkDBSparse(const mjModel* m) {
}
// integer valued dst[D or C or M] = src[M (legacy)], handle different sparsity representations
static void copyM2Sparse(int nv,
const int* dof_Madr, const int* dof_simplenum, const int* dof_parentid,
@@ -1008,7 +990,6 @@ static void mj_setPtrData(const mjModel* m, mjData* d) {
}
// initialize plugins, copy into d (required for deletion)
void mj_initPlugin(const mjModel* m, mjData* d) {
d->nplugin = m->nplugin;
@@ -1025,7 +1006,6 @@ void mj_initPlugin(const mjModel* m, mjData* d) {
}
// free mjData memory without destroying the struct
static void freeDataBuffers(mjData* d) {
#ifdef ADDRESS_SANITIZER
@@ -1045,7 +1025,6 @@ static void freeDataBuffers(mjData* d) {
}
// allocate and initialize raw mjData structure
void mj_makeRawData(mjData** dest, const mjModel* m) {
intptr_t offset = 0;
@@ -1114,7 +1093,6 @@ void mj_makeRawData(mjData** dest, const mjModel* m) {
}
// allocate and initialize mjData structure
mjData* mj_makeData(const mjModel* m) {
mjData* d = NULL;
@@ -1127,7 +1105,6 @@ mjData* mj_makeData(const mjModel* m) {
}
// copy mjData, if dest==NULL create new data;
// flg_all 1: copy all fields, 0: skip fields not required for visualization
mjData* mj_copyDataVisual(mjData* dest, const mjModel* m, const mjData* src, int flg_all) {
@@ -1275,7 +1252,6 @@ mjData* mjv_copyData(mjData* dest, const mjModel* m, const mjData* src) {
}
// clear data, set defaults
static void _resetData(const mjModel* m, mjData* d, unsigned char debug_value) {
//------------------------------ save plugin state and data
@@ -1428,21 +1404,18 @@ static void _resetData(const mjModel* m, mjData* d, unsigned char debug_value) {
}
// clear data, set data->qpos = model->qpos0
void mj_resetData(const mjModel* m, mjData* d) {
_resetData(m, d, 0);
}
// clear data, set data->qpos = model->qpos0, fill with debug_value
void mj_resetDataDebug(const mjModel* m, mjData* d, unsigned char debug_value) {
_resetData(m, d, debug_value);
}
// Reset data. If 0 <= key < nkey, set fields from specified keyframe.
void mj_resetDataKeyframe(const mjModel* m, mjData* d, int key) {
_resetData(m, d, 0);
@@ -1460,7 +1433,6 @@ void mj_resetDataKeyframe(const mjModel* m, mjData* d, int key) {
}
// de-allocate mjData
void mj_deleteData(mjData* d) {
if (d) {
@@ -1470,7 +1442,6 @@ void mj_deleteData(mjData* d) {
}
// number of position and velocity coordinates for each joint type
const int nPOS[4] = {7, 4, 1, 1};
const int nVEL[4] = {6, 3, 1, 1};
@@ -1546,7 +1517,6 @@ static int sensorSize(mjtSensor sensor_type, int sensor_dim) {
}
// returns the number of objects of the given type
// -1: mjOBJ_UNKNOWN
// -2: invalid objtype
@@ -1613,7 +1583,6 @@ static int numObjects(const mjModel* m, mjtObj objtype) {
}
// validate reference fields in a model; return null if valid, error message otherwise
const char* mj_validateReferences(const mjModel* m) {
// for each field in mjModel that refers to another field, call X with: