/** @file\r
+File for memory allocation tracking functions.\r
\r
-Copyright (c) 2004 - 2008, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
\r
-Module Name:\r
-\r
- MyAlloc.c\r
-\r
-Abstract:\r
-\r
- File for memory allocation tracking functions.\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
//\r
// Check parameters.\r
//\r
- if (File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyCheck(Final=%u, File=NULL, Line=%u)"\r
+ "Invalid parameter(s).\n",\r
+ Final,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Line == 0) {\r
printf (\r
"\nMyCheck(Final=%u, File=%s, Line=%u)"\r
"Invalid parameter(s).\n",\r
Final,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
"Invalid parameter.\n",\r
Final,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
"\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",\r
Final,\r
File,\r
- (UINT32)Line,\r
+ (unsigned)Line,\r
Tmp->File,\r
- (UINT32)Tmp->Line,\r
- (UINT32)Tmp->Size,\r
- *(UINT32 *) (Tmp->Buffer),\r
- *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
+ (unsigned) Tmp->Line,\r
+ (unsigned) Tmp->Size,\r
+ (unsigned) *(UINT32 *) (Tmp->Buffer),\r
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
);\r
\r
exit (1);\r
"\nSome allocated items have not been freed.\n",\r
Final,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {\r
printf (\r
"File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",\r
Tmp->File,\r
- (UINT32)Tmp->Line,\r
- (UINT32)Tmp->Size,\r
- *(UINT32 *) (Tmp->Buffer),\r
- *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
+ (unsigned) Tmp->Line,\r
+ (unsigned) Tmp->Size,\r
+ (unsigned) *(UINT32 *) (Tmp->Buffer),\r
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])\r
);\r
}\r
}\r
//\r
// Check for invalid parameters.\r
//\r
- if (Size == 0 || File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyAlloc(Size=%u, File=NULL, Line=%u)"\r
+ "\nInvalid parameter(s).\n",\r
+ (unsigned)Size,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Size == 0 || Line == 0) {\r
printf (\r
"\nMyAlloc(Size=%u, File=%s, Line=%u)"\r
"\nInvalid parameter(s).\n",\r
- (UINT32)Size,\r
+ (unsigned)Size,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
printf (\r
"\nMyAlloc(Size=%u, File=%s, Line=%u)"\r
"\nInvalid parameter.\n",\r
- (UINT32)Size,\r
+ (unsigned)Size,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
printf (\r
"\nMyAlloc(Size=%u, File=%s, Line=%u)"\r
"\nOut of memory.\n",\r
- (UINT32)Size,\r
+ (unsigned)Size,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
//\r
// Check for invalid parameter(s).\r
//\r
- if (Size == 0 || File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyRealloc(Ptr=%p, Size=%u, File=NULL, Line=%u)"\r
+ "\nInvalid parameter(s).\n",\r
+ Ptr,\r
+ (unsigned)Size,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Size == 0 || Line == 0) {\r
printf (\r
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"\r
"\nInvalid parameter(s).\n",\r
Ptr,\r
- (UINT32)Size,\r
+ (unsigned)Size,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"\r
"\nInvalid parameter.\n",\r
Ptr,\r
- (UINT32)Size,\r
+ (unsigned)Size,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"\r
"\nCould not find buffer.\n",\r
Ptr,\r
- (UINT32)Size,\r
+ (unsigned)Size,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
//\r
// Check for invalid parameter(s).\r
//\r
- if (File == NULL || Line == 0) {\r
+ if (File == NULL) {\r
+ printf (\r
+ "\nMyFree(Ptr=%p, File=NULL, Line=%u)"\r
+ "\nInvalid parameter(s).\n",\r
+ Ptr,\r
+ (unsigned)Line\r
+ );\r
+\r
+ exit (1);\r
+ }\r
+\r
+ if (Line == 0) {\r
printf (\r
"\nMyFree(Ptr=%p, File=%s, Line=%u)"\r
"\nInvalid parameter(s).\n",\r
Ptr,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
"\nInvalid parameter.\n",\r
Ptr,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
"\nCalled before memory allocated.\n",\r
Ptr,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r
"\nNot found.\n",\r
Ptr,\r
File,\r
- (UINT32)Line\r
+ (unsigned)Line\r
);\r
\r
exit (1);\r