mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-18 09:26:17 +00:00
cmd: Introduce xrealloc helper.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
76237079d1
commit
93354bbd88
|
@ -271,13 +271,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
|
||||||
if (tmpLen > widest) widest = tmpLen;
|
if (tmpLen > widest) widest = tmpLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = realloc(fd, (entry_count + 1) * sizeof(WIN32_FIND_DATAW));
|
fd = xrealloc(fd, (entry_count + 1) * sizeof(WIN32_FIND_DATAW));
|
||||||
if (fd == NULL) {
|
|
||||||
FindClose (hff);
|
|
||||||
WINE_ERR("Out of memory\n");
|
|
||||||
errorlevel = 1;
|
|
||||||
return parms->next;
|
|
||||||
}
|
|
||||||
} while (FindNextFileW(hff, &fd[entry_count]) != 0);
|
} while (FindNextFileW(hff, &fd[entry_count]) != 0);
|
||||||
FindClose (hff);
|
FindClose (hff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,12 @@ void WCMD_free_commands(CMD_LIST *cmds);
|
||||||
void WCMD_execute (const WCHAR *orig_command, const WCHAR *redirects,
|
void WCMD_execute (const WCHAR *orig_command, const WCHAR *redirects,
|
||||||
CMD_LIST **cmdList, BOOL retrycall);
|
CMD_LIST **cmdList, BOOL retrycall);
|
||||||
|
|
||||||
void *xalloc(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(free) __WINE_MALLOC;
|
void *xrealloc(void *, size_t) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(free) __WINE_MALLOC;
|
||||||
|
|
||||||
|
static inline void *xalloc(size_t sz)
|
||||||
|
{
|
||||||
|
return xrealloc(NULL, sz);
|
||||||
|
}
|
||||||
|
|
||||||
static inline WCHAR *xstrdupW(const WCHAR *str)
|
static inline WCHAR *xstrdupW(const WCHAR *str)
|
||||||
{
|
{
|
||||||
|
|
|
@ -423,12 +423,12 @@ static void WCMD_show_prompt (BOOL newLine) {
|
||||||
WCMD_output_asis (out_string);
|
WCMD_output_asis (out_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *xalloc(size_t size)
|
void *xrealloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
ret = malloc(size);
|
if (!(ret = realloc(ptr, size)))
|
||||||
if(!ret) {
|
{
|
||||||
ERR("Out of memory\n");
|
ERR("Out of memory\n");
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue