LibC: Some build fixes for strange platforms

Patch from Anonymous.
This commit is contained in:
Andreas Kling 2019-09-29 21:02:13 +02:00
parent 3900eebf15
commit 6d7854919a
Notes: sideshowbarker 2024-07-19 11:52:58 +09:00
4 changed files with 11 additions and 4 deletions

View file

@ -6,20 +6,24 @@ extern "C" {
int dlclose(void*)
{
ASSERT_NOT_REACHED();
return 0;
}
char* dlerror()
{
ASSERT_NOT_REACHED();
return nullptr;
}
void* dlopen(const char*, int)
{
ASSERT_NOT_REACHED();
return nullptr;
}
void* dlsym(void*, const char*)
{
ASSERT_NOT_REACHED();
return nullptr;
}
}

View file

@ -146,7 +146,7 @@ void* malloc(size_t size)
LOCKER(malloc_lock());
if (s_log_malloc)
dbgprintf("LibC: malloc(%u)\n", size);
dbgprintf("LibC: malloc(%zu)\n", size);
if (!size)
return nullptr;
@ -190,13 +190,13 @@ void* malloc(size_t size)
block->m_freelist = block->m_freelist->next;
if (block->is_full()) {
#ifdef MALLOC_DEBUG
dbgprintf("Block %p is now full in size class %u\n", block, good_size);
dbgprintf("Block %p is now full in size class %zu\n", block, good_size);
#endif
allocator->usable_blocks.remove(block);
allocator->full_blocks.append(block);
}
#ifdef MALLOC_DEBUG
dbgprintf("LibC: allocated %p (chunk in block %p, size %u)\n", ptr, block, block->bytes_per_chunk());
dbgprintf("LibC: allocated %p (chunk in block %p, size %zu)\n", ptr, block, block->bytes_per_chunk());
#endif
if (s_scrub_malloc)
memset(ptr, MALLOC_SCRUB_BYTE, block->m_size);

View file

@ -30,6 +30,7 @@
*/
#include <ctype.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@ -60,7 +61,8 @@ static const char* determine_base(const char* p, int& base)
static int _atob(unsigned long* vp, const char* p, int base)
{
unsigned long value, v1, v2;
char *q, tmp[20];
const char *q;
char tmp[20];
int digit;
if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {

View file

@ -8,5 +8,6 @@ long ulimit(int cmd, long newlimit)
(void)cmd;
(void)newlimit;
ASSERT_NOT_REACHED();
return -1;
}
}