foxygit / doom Log in
commit ca6424121b6db33b7ce6e6d8671f9fa32b22e4cc
Merge: 8a52bc04 cb793641
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Wed Aug 23 08:44:21 2017 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Wed Aug 23 08:47:22 2017 +0200

    Merge branch 'master' into sdl2-branch

 src/i_system.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --cc src/i_system.c
index 7cb55c4c,da2225c6..2796ab76
--- a/src/i_system.c
+++ b/src/i_system.c
@@@ -311,22 -399,62 +311,40 @@@ void I_Error (char *error, ...
      // game was not run from the console (and the user will
      // therefore be unable to otherwise see the message).
      if (exit_gui_popup && !I_ConsoleStdout())
 -#ifdef _WIN32
      {
 -        wchar_t wmsgbuf[512];
 +        SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
 +                                 PACKAGE_STRING, msgbuf, NULL);
 +    }

 -        MultiByteToWideChar(CP_ACP, 0,
 -                            msgbuf, strlen(msgbuf) + 1,
 -                            wmsgbuf, sizeof(wmsgbuf));
 +    // abort();

 -        MessageBoxW(NULL, wmsgbuf, L"", MB_OK);
 -    }
 -#elif defined(__MACOSX__)
 -    {
 -        CFStringRef message;
 -	int i;
 +    SDL_Quit();

 -	// The CoreFoundation message box wraps text lines, so replace
 -	// newline characters with spaces so that multiline messages
 -	// are continuous.
 +    exit(-1);
 +}

 -	for (i = 0; msgbuf[i] != '\0'; ++i)
 -        {
 -            if (msgbuf[i] == '\n')
 -            {
 -                msgbuf[i] = ' ';
 -            }
 -        }
 +//
 +// I_Realloc
 +//

 -        message = CFStringCreateWithCString(NULL, msgbuf,
 -                                            kCFStringEncodingUTF8);
 -
 -        CFUserNotificationDisplayNotice(0,
 -                                        kCFUserNotificationCautionAlertLevel,
 -                                        NULL,
 -                                        NULL,
 -                                        NULL,
 -                                        CFSTR(PACKAGE_STRING),
 -                                        message,
 -                                        NULL);
 -    }
 -#else
 -    {
 -        ZenityErrorBox(msgbuf);
 -    }
 -#endif
++void *I_Realloc(void *ptr, size_t size)
++{
++    void *new_ptr;
+
 -    // abort();
++    new_ptr = realloc(ptr, size);
+
 -    SDL_Quit();
++    if (size != 0 && new_ptr == NULL)
++    {
++        I_Error ("I_Realloc: failed on reallocation of %i bytes", size);
++    }
+
 -    exit(-1);
++    return new_ptr;
+ }
+
+ //
+ // I_Realloc
+ //
+
  void *I_Realloc(void *ptr, size_t size)
  {
      void *new_ptr;