void *MDFN_realloc_real(bool dothrow, void *ptr, uint32 size, const char *purpose, const char *_file, const int _line) { void *ret; ret = realloc(ptr, size); if(!ret) { if(dothrow) { ErrnoHolder ene; throw MDFN_Error(ene.Errno(), _("Error allocating(realloc) %u bytes for \"%s\" in %s(%d)!"), size, purpose, _file, _line); } else { MDFN_PrintError(_("Error allocating(realloc) %u bytes for \"%s\" in %s(%d)!"), size, purpose, _file, _line); return(0); } } return ret; }
MDFN_Error::MDFN_Error(const ErrnoHolder &enh) { errno_code = enh.Errno(); error_message = strdup(enh.StrError()); }
MDFN_Error::MDFN_Error(const ErrnoHolder &enh) { errno_code = enh.Errno(); error_message = trio_aprintf("%s", enh.StrError()); }
MDFN_Error::MDFN_Error(const ErrnoHolder &enh) { errno_code = enh.Errno(); asprintf(&error_message, "%s", enh.StrError()); }