\r
Module to rewrite stdlib references within Oniguruma\r
\r
- Copyright (c) 2014-2015, Hewlett-Packard Development Company, L.P.<BR>\r
+ (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP<BR>\r
\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License that accompanies this\r
\r
#define malloc(n) AllocatePool(n)\r
#define calloc(n,s) AllocateZeroPool((n)*(s))\r
-#define free(p) FreePool(p)\r
+\r
+#define free(p) \\r
+ do { \\r
+ VOID *EvalOnce; \\r
+ \\r
+ EvalOnce = (p); \\r
+ if (EvalOnce != NULL) { \\r
+ FreePool (EvalOnce); \\r
+ } \\r
+ } while (FALSE)\r
+\r
#define realloc(OldPtr,NewSize,OldSize) ReallocatePool(OldSize,NewSize,OldPtr)\r
#define xmemmove(Dest,Src,Length) CopyMem(Dest,Src,Length)\r
#define xmemcpy(Dest,Src,Length) CopyMem(Dest,Src,Length)\r
#define setlocale(a,b)\r
#define LC_ALL 0\r
\r
-//#define MAX_STRING_SIZE 0x1000\r
+#define MAX_STRING_SIZE 0x1000\r
#define strlen_s(String,MaxSize) AsciiStrnLenS (String, MaxSize)\r
#define strcat_s(Dest,MaxSize,Src) AsciiStrCatS (Dest, MaxSize, Src)\r
#define strncpy_s(Dest,MaxSize,Src,Length) AsciiStrnCpyS (Dest, MaxSize, Src, Length)\r
\r
int OnigStrCmp (char* Str1, char* Str2);\r
\r
-int sprintf (char *str, char const *fmt, ...);\r
+int EFIAPI sprintf_s (char *str, size_t sizeOfBuffer, char const *fmt, ...);\r
\r
#define exit(n) ASSERT(FALSE);\r
\r