Reverted more MEM2 Allocation to prevent black screen when launching a game. (Thanks Dimok)

This commit is contained in:
Cyan 2013-04-13 14:53:23 +00:00
parent f145fb1e91
commit da71bf99dc
6 changed files with 11 additions and 15 deletions

View File

@ -280,7 +280,7 @@ struct CACHED_GENERIC *ntfs_enter_cache(struct CACHE_HEADER *cache,
cache->oldest_entry = current->previous;
if (item->varsize) {
if (current->varsize)
current->variable = realloc(
current->variable = MEM2_realloc(
current->variable,
item->varsize);
else

View File

@ -1279,7 +1279,7 @@ static int ntfs_ie_add_vcn(INDEX_ENTRY **ie)
INDEX_ENTRY *p, *old = *ie;
old->length = cpu_to_le16(le16_to_cpu(old->length) + sizeof(VCN));
p = realloc(old, le16_to_cpu(old->length));
p = MEM2_realloc(old, le16_to_cpu(old->length));
if (!p)
return STATUS_ERROR;

View File

@ -356,7 +356,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count,
/* Reallocate memory if necessary. */
if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) {
rlsize += 4096;
trl = realloc(rl, rlsize);
trl = MEM2_realloc(rl, rlsize);
if (!trl) {
err = ENOMEM;
ntfs_log_perror("realloc() failed");

View File

@ -28,20 +28,12 @@
static inline void* ntfs_alloc (size_t size)
{
#ifdef __wii__
return MEM2_alloc(size);
#else
return malloc(size);
#endif
}
static inline void* ntfs_align (size_t size)
{
#ifdef __wii__
return memalign(32, size);
#else
return malloc(size);
#endif
return MEM2_alloc(size);
}
static inline void ntfs_free (void* mem)

View File

@ -34,6 +34,7 @@
#include "types.h"
#include "misc.h"
#include "logging.h"
#include "mem2.h"
/**
* ntfs_calloc
@ -44,7 +45,10 @@ void *ntfs_calloc(size_t size)
{
void *p;
p = calloc(1, size);
p = MEM2_alloc(size);
if(p)
memset(p, 0, size);
if (!p)
ntfs_log_perror("Failed to calloc %lld bytes", (long long)size);
return p;
@ -54,7 +58,7 @@ void *ntfs_malloc(size_t size)
{
void *p;
p = malloc(size);
p = MEM2_alloc(size);
if (!p)
ntfs_log_perror("Failed to malloc %lld bytes", (long long)size);
return p;

View File

@ -1011,7 +1011,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
if (o >= ucs_len) {
ntfschar *tc;
ucs_len = (ucs_len * sizeof(ntfschar) + 64) & ~63;
tc = realloc(ucs, ucs_len);
tc = MEM2_realloc(ucs, ucs_len);
if (!tc)
goto err_out;
ucs = tc;