1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

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
4 changed files with 11 additions and 4 deletions

View file

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

View file

@ -146,7 +146,7 @@ void* malloc(size_t size)
LOCKER(malloc_lock()); LOCKER(malloc_lock());
if (s_log_malloc) if (s_log_malloc)
dbgprintf("LibC: malloc(%u)\n", size); dbgprintf("LibC: malloc(%zu)\n", size);
if (!size) if (!size)
return nullptr; return nullptr;
@ -190,13 +190,13 @@ void* malloc(size_t size)
block->m_freelist = block->m_freelist->next; block->m_freelist = block->m_freelist->next;
if (block->is_full()) { if (block->is_full()) {
#ifdef MALLOC_DEBUG #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 #endif
allocator->usable_blocks.remove(block); allocator->usable_blocks.remove(block);
allocator->full_blocks.append(block); allocator->full_blocks.append(block);
} }
#ifdef MALLOC_DEBUG #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 #endif
if (s_scrub_malloc) if (s_scrub_malloc)
memset(ptr, MALLOC_SCRUB_BYTE, block->m_size); memset(ptr, MALLOC_SCRUB_BYTE, block->m_size);

View file

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