Add engine internal error macro mjERROR to prepend calling function to error function.

PiperOrigin-RevId: 541584847
Change-Id: I57447e64375413ee07aa96372a402e1ced59ff4a
This commit is contained in:
Kyle Bayes
2023-06-19 03:28:44 -07:00
committed by Copybara-Service
parent c9e9cd8b35
commit ac1f41160d
28 changed files with 218 additions and 162 deletions
+4 -4
View File
@@ -37,10 +37,10 @@ static void vfs_strippath(char* newname, const char* oldname) {
// check resulting length
if (sz-(i+1) >= mjMAXVFSNAME) {
mju_error("Filename too long in VFS");
mjERROR("filename too long");
}
if (sz-(i+1) <= 0) {
mju_error("Empty filename in VFS");
mjERROR("empty filename");
}
// copy
@@ -117,7 +117,7 @@ int mj_makeEmptyFileVFS(mjVFS* vfs, const char* filename, int filesize) {
// check filesize
if (filesize <= 0) {
mju_error("mj_makeEmptyFileVFS expects positive filesize");
mjERROR("expects positive filesize");
}
// strip path
@@ -137,7 +137,7 @@ int mj_makeEmptyFileVFS(mjVFS* vfs, const char* filename, int filesize) {
// allocate and clear
vfs->filedata[vfs->nfile] = mju_malloc(filesize);
if (!vfs->filedata[vfs->nfile]) {
mju_error("mj_makeEmptyFileVFS: could not allocate memory");
mjERROR("could not allocate memory");
}
memset(vfs->filedata[vfs->nfile], 0, filesize);