[Ttssh2-commit] [8391] _CRTDBG_MAP_ALLOC を使ってデバッグバージョンのヒープ割り当て関数へ切り替え

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 11月 22日 (金) 00:00:03 JST


Revision: 8391
          https://osdn.net/projects/ttssh2/scm/svn/commits/8391
Author:   zmatsuo
Date:     2019-11-22 00:00:01 +0900 (Fri, 22 Nov 2019)
Log Message:
-----------
_CRTDBG_MAP_ALLOC を使ってデバッグバージョンのヒープ割り当て関数へ切り替え

- r8390

Revision Links:
--------------
    https://osdn.net/projects/ttssh2/scm/svn/commits/8390

Modified Paths:
--------------
    trunk/teraterm/common/codeconv.cpp
    trunk/teraterm/common/dlglib.c
    trunk/teraterm/common/dlglib_cpp.cpp
    trunk/teraterm/common/dlglib_tmpl.cpp
    trunk/teraterm/teraterm/WSAAsyncGetAddrInfo.c
    trunk/teraterm/teraterm/ttime.c
    trunk/teraterm/teraterm/vtterm.c
    trunk/teraterm/teraterm/winjump.c
    trunk/teraterm/ttpmacro/ttmbuff.c
    trunk/teraterm/ttpmacro/ttmdlg.cpp
    trunk/teraterm/ttpmacro/ttmparse.c
    trunk/ttssh2/ttxssh/auth.c

-------------- next part --------------
Modified: trunk/teraterm/common/codeconv.cpp
===================================================================
--- trunk/teraterm/common/codeconv.cpp	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/common/codeconv.cpp	2019-11-21 15:00:01 UTC (rev 8391)
@@ -31,6 +31,10 @@
 #include <windows.h>
 #include <string.h>
 #include <assert.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || !defined(_MSC_VER)
 #include <stdint.h>
@@ -47,13 +51,6 @@
 typedef unsigned int	uint32_t;
 #endif
 
-#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
-#define malloc(l)     _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)       _free_dbg((p), _NORMAL_BLOCK)
-#define _strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define _wcsdup(s)    _wcsdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#endif
-
 /*
  *	\x8C\xA9\x82‚\xA9\x82\xE7\x82Ȃ\xA2\x8Fꍇ\x82\xCD 0 \x82\xF0\x95Ԃ\xB7
  */

Modified: trunk/teraterm/common/dlglib.c
===================================================================
--- trunk/teraterm/common/dlglib.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/common/dlglib.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -36,14 +36,13 @@
 #include <stdio.h>
 #include <commctrl.h>
 #include <tchar.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 #include "ttlib.h"	// for get_lang_font()
 
-#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
-#define malloc(l) _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)   _free_dbg((p), _NORMAL_BLOCK)
-#endif
-
 void EnableDlgItem(HWND HDlg, int FirstId, int LastId)
 {
 	int i;

Modified: trunk/teraterm/common/dlglib_cpp.cpp
===================================================================
--- trunk/teraterm/common/dlglib_cpp.cpp	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/common/dlglib_cpp.cpp	2019-11-21 15:00:01 UTC (rev 8391)
@@ -29,16 +29,15 @@
 /* Routines for dialog boxes */
 
 #include <windows.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 
 #include "dlglib.h"
 #include "ttlib.h"
 
-#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
-#define malloc(l) _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)   _free_dbg((p), _NORMAL_BLOCK)
-#endif
-
 // \x83_\x83C\x83A\x83\x8D\x83O\x83\x82\x81[\x83_\x83\x8B\x8F\xF3\x91Ԃ̎\x9E\x81AOnIdle()\x82\xF0\x8E\xC0\x8Ds\x82\xB7\x82\xE9
 //#define ENABLE_CALL_IDLE_MODAL	1
 

Modified: trunk/teraterm/common/dlglib_tmpl.cpp
===================================================================
--- trunk/teraterm/common/dlglib_tmpl.cpp	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/common/dlglib_tmpl.cpp	2019-11-21 15:00:01 UTC (rev 8391)
@@ -32,15 +32,12 @@
 
 #include <wchar.h>
 #include <assert.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 
-#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
-#define malloc(l) _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)   _free_dbg((p), _NORMAL_BLOCK)
-#endif
-
-//#define	_countof(ary)	(sizeof(ary)/sizeof(ary[0]))
-
 // https://docs.microsoft.com/ja-jp/windows/desktop/dlgbox/dlgtemplateex
 // https://www.pg-fl.jp/program/tips/dlgmem.htm
 #pragma pack(push, 1)

Modified: trunk/teraterm/teraterm/WSAAsyncGetAddrInfo.c
===================================================================
--- trunk/teraterm/teraterm/WSAAsyncGetAddrInfo.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/teraterm/WSAAsyncGetAddrInfo.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -34,6 +34,10 @@
 #include <wspiapi.h>
 #include <windows.h>
 #include <process.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 #include "WSAAsyncGetAddrInfo.h"
 #include "ttwsk.h"
@@ -48,12 +52,6 @@
   HANDLE *lpHandle;
 };
 
-#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
-#define malloc(l)	_malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)		_free_dbg((p), _NORMAL_BLOCK)
-#define _strdup(s)	_strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#endif
-
 static unsigned __stdcall getaddrinfo_thread(void * p);
 
 HANDLE PASCAL WSAAsyncGetAddrInfo(HWND hWnd, unsigned int wMsg,

Modified: trunk/teraterm/teraterm/ttime.c
===================================================================
--- trunk/teraterm/teraterm/ttime.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/teraterm/ttime.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -30,20 +30,17 @@
 /* TERATERM.EXE, IME interface */
 
 #include <windows.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
 #include <stdlib.h>
+#include <crtdbg.h>
 #include <string.h>
 #include <imm.h>
-#include <crtdbg.h>
 #include <assert.h>
 
 #include "ttime.h"
 
-#ifdef _DEBUG
-#define malloc(l)	_malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define calloc(l,n)	_calloc_dbg((l), (n), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)		_free_dbg((p), _NORMAL_BLOCK)
-#endif
-
 // #define ENABLE_DUMP	1
 
 typedef LONG (WINAPI *TImmGetCompositionStringA)(HIMC, DWORD, LPVOID, DWORD);

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/teraterm/vtterm.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -32,10 +32,13 @@
 #include "tttypes.h"
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
 #include <mbstring.h>
 #include <locale.h>
 #include <ctype.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 #include <tchar.h>
 
@@ -56,14 +59,6 @@
 
 #include "vtterm.h"
 
-#ifdef _DEBUG
-#define malloc(l)     _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define realloc(p, l) _realloc_dbg((p), (l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)       _free_dbg((p), _NORMAL_BLOCK)
-#define strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define _strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#endif
-
 void ParseFirst(BYTE b);
 
 #define MAPSIZE(x) (sizeof(x)/sizeof((x)[0]))

Modified: trunk/teraterm/teraterm/winjump.c
===================================================================
--- trunk/teraterm/teraterm/winjump.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/teraterm/winjump.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -53,6 +53,10 @@
 #include <stdio.h>
 #include <string.h>
 #include <shlobj.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 
 #include "winjump.h"
@@ -59,12 +63,6 @@
 #include "teraterm.h"
 #include "tttypes.h"
 
-#ifdef _DEBUG
-#define malloc(l)	_malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)		_free_dbg((p), _NORMAL_BLOCK)
-#define _strdup(s)	_strdup_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
-#endif
-
 #define MAX_JUMPLIST_ITEMS 30 /* PuTTY will never show more items in
                                * the jumplist than this, regardless of
                                * user preferences. */

Modified: trunk/teraterm/ttpmacro/ttmbuff.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmbuff.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/ttpmacro/ttmbuff.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -31,6 +31,9 @@
 
 #include "teraterm.h"
 #include <string.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
 #include <stdlib.h>
 #include <crtdbg.h>
 #include "ttmparse.h"
@@ -39,11 +42,6 @@
 
 #include "ttmbuff.h"
 
-#ifdef _DEBUG
-#define malloc(l)     _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)       _free_dbg((p), _NORMAL_BLOCK)
-#endif
-
 int EndWhileFlag;
 int BreakFlag;
 BOOL ContinueFlag;

Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.cpp	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/ttpmacro/ttmdlg.cpp	2019-11-21 15:00:01 UTC (rev 8391)
@@ -32,6 +32,10 @@
 #include <windows.h>
 #include <direct.h>
 #include <commdlg.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 #include <assert.h>
 
@@ -50,15 +54,6 @@
 
 #include "ttmdlg.h"
 
-#ifdef _DEBUG
-#define malloc(l)     _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define realloc(p, l) _realloc_dbg((p), (l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define calloc(c, s)  _calloc_dbg((c), (s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)       _free_dbg((p), _NORMAL_BLOCK)
-#define strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define _strdup(s)	  _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#endif
-
 char HomeDir[MAX_PATH];
 char FileName[MAX_PATH];
 char TopicName[11];

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -33,17 +33,15 @@
 #include <string.h>
 #include <stdio.h>
 #include <ctype.h>
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 #include "ttmdlg.h"
 #include "ttmparse.h"
 #include "ttmbuff.h"
 
-#ifdef _DEBUG
-#define calloc(c, s)  _calloc_dbg((c), (s), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define malloc(l)     _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)       _free_dbg((p), _NORMAL_BLOCK)
-#endif
-
 /* C\x8C\xBE\x8C\xEA\x83X\x83^\x83C\x83\x8B\x82̃R\x83\x81\x83\x93\x83g\x82\xF0\x83T\x83|\x81[\x83g\x82\xB7\x82邩\x82ǂ\xA4\x82\xA9 (2009.7.2 yutaka) */
 #define SUPPORT_C_STYLE_COMMENT
 static int commenting = 0;   /* C\x8C\xBE\x8C\xEA\x83R\x83\x81\x83\x93\x83g */

Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2019-11-21 14:44:46 UTC (rev 8390)
+++ trunk/ttssh2/ttxssh/auth.c	2019-11-21 15:00:01 UTC (rev 8391)
@@ -39,6 +39,10 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <lmcons.h>		// for UNLEN
+#if !defined(_CRTDBG_MAP_ALLOC)
+#define _CRTDBG_MAP_ALLOC
+#endif
+#include <stdlib.h>
 #include <crtdbg.h>
 
 #include "resource.h"
@@ -48,11 +52,6 @@
 #include "auth.h"
 #include "helpid.h"
 
-#if defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
-#define malloc(l) _malloc_dbg((l), _NORMAL_BLOCK, __FILE__, __LINE__)
-#define free(p)   _free_dbg((p), _NORMAL_BLOCK)
-#endif
-
 #define AUTH_START_USER_AUTH_ON_ERROR_END 1
 
 #define MAX_AUTH_CONTROL IDC_SSHUSEPAGEANT


Ttssh2-commit メーリングリストの案内
Back to archive index