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
+3 -3
View File
@@ -53,7 +53,7 @@ mjResource* mju_openResource(const char* name, int default_provider) {
mjResource* resource = (mjResource*) mju_malloc(sizeof(mjResource));
const mjpResourceProvider* provider = NULL;
if (resource == NULL) {
mju_error("mju_openResource: could not allocate memory");
mjERROR("could not allocate memory");
return NULL;
}
@@ -61,7 +61,7 @@ mjResource* mju_openResource(const char* name, int default_provider) {
resource->name = mju_malloc(sizeof(char) * (strlen(name) + 1));
if (resource->name == NULL) {
mju_free(resource);
mju_error("mju_openResource: could not allocate memory");
mjERROR("could not allocate memory");
return NULL;
}
strcpy(resource->name, name);
@@ -249,7 +249,7 @@ void* mju_fileToMemory(const char* filename, int* filesize) {
// allocate and read
void* buffer = mju_malloc(*filesize);
if (!buffer) {
mju_error("mjFileToMemory: could not allocate memory");
mjERROR("could not allocate memory");
}
size_t bytes_read = fread(buffer, 1, *filesize, fp);