Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 0 additions & 196 deletions .clang-format

This file was deleted.

4 changes: 2 additions & 2 deletions library/dos.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ struct _clib4 {
BOOL __unlock_current_directory;

/* Memalign memory list */
void *__memalign_pool;
struct AVLNode *__memalign_tree;
void *unused2;
void *unused3;

/*
* This variable can be set up to contain the minimum stack size the program
Expand Down
7 changes: 6 additions & 1 deletion library/fcntl/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,15 @@ open(const char *path_name, int open_flag, ... /* mode_t mode */) {
if (handle != BZERO)
Close(handle);

FreeDosObject(DOS_EXAMINEDATA, fib);
if (fib != NULL)
FreeDosObject(DOS_EXAMINEDATA, fib);

if (lock != BZERO)
UnLock(lock);

if (dir_lock != BZERO)
UnLock(dir_lock);

__stdio_unlock(__clib4);

RETURN(result);
Expand Down
47 changes: 0 additions & 47 deletions library/libc_init_global.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ reent_init(struct _clib4 *__clib4, BOOL fallback) {
.__priority = 256,
.pipenum = 0,
.tgoto_buf = {0},
/* Set memalign tree to NULL */
.__memalign_tree = NULL,
/* Initialize pipe semaphore */
.__pipe_semaphore = __create_semaphore(),
/* Initialize random signal and state */
Expand Down Expand Up @@ -354,23 +352,6 @@ reent_init(struct _clib4 *__clib4, BOOL fallback) {
D(("Check if altivec is present"));
GetCPUInfoTags(GCIT_VectorUnit, &__clib4->hasAltivec, TAG_DONE);

/* Init memalign list */
if (!fallback) {
SHOWMSG("Allocating __memalign_pool");
__clib4->__memalign_pool = AllocSysObjectTags(ASOT_ITEMPOOL,
ASO_NoTrack, FALSE,
ASO_MemoryOvr, MEMF_SHARED,
ASOITEM_MFlags, MEMF_SHARED,
ASOITEM_ItemSize, sizeof(struct MemalignEntry),
ASOITEM_BatchSize, 408,
ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
ASOITEM_GCParameter, 1000,
TAG_DONE);
if (!__clib4->__memalign_pool) {
goto out;
}
}

__clib4->__IDebug = (struct DebugIFace *) GetInterface((struct Library *) IExec->Data.LibBase, "debug", 1, NULL);
D(("__clib4->__IDebug %p", __clib4->__IDebug));
if (!__clib4->__IDebug) {
Expand Down Expand Up @@ -463,34 +444,6 @@ reent_exit(struct _clib4 *__clib4, BOOL fallback) {
/* Remove pipe semaphore */
SHOWMSG("Delete __pipe_semaphore semaphore");
__delete_semaphore(__clib4->__pipe_semaphore);
if (!fallback) { //TODO : Freeing memalign crash libExpunge and I don't know why
/* Free memalign stuff */
if (__clib4->__memalign_pool) {
SHOWMSG("Freeing memalign pool");
/* Check if we have something created with posix_memalign and not freed yet.
* But this is a good point also to free something allocated with memalign or
* aligned_alloc and all other functions are using memalign_tree to allocate memory
* This seems to cure also the memory leaks found sometimes (but not 100% sure..)
*/
struct MemalignEntry *e = (struct MemalignEntry *) AVL_FindFirstNode(__clib4->__memalign_tree);
while (e) {
struct MemalignEntry *next = (struct MemalignEntry *) AVL_FindNextNodeByAddress(&e->me_AvlNode);

/* Free memory */
if (e->me_Exact) {
FreeVec(e->me_Exact);
}
/* Remove the node */
AVL_RemNodeByAddress(&__clib4->__memalign_tree, &e->me_AvlNode);
ItemPoolFree(__clib4->__memalign_pool, e);

e = next;
}

FreeSysObject(ASOT_ITEMPOOL, __clib4->__memalign_pool);
SHOWMSG("Done");
}
}
/* Free dl stuff */
struct ElfIFace *IElf = __IElf;

Expand Down
8 changes: 2 additions & 6 deletions library/misc/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ struct hashmap *hashmap_new_with_allocator(
void (*elfree)(void *item),
void *udata) {

DECLARE_UTILITYBASE();

size_t ncap = 16;
if (cap < ncap) {
cap = ncap;
Expand All @@ -91,11 +89,10 @@ struct hashmap *hashmap_new_with_allocator(
}
// hashmap + spare + edata
size_t size = sizeof(struct hashmap) + bucketsz * 2;
struct hashmap *map = AllocVecTags(size, AVT_Type, MEMF_SHARED, TAG_DONE);
struct hashmap *map = AllocVecTags(size, AVT_Type, MEMF_SHARED, AVT_ClearWithValue, 0, TAG_DONE);
if (!map) {
return NULL;
}
ClearMem(map, sizeof(struct hashmap));
map->elsize = elsize;
map->bucketsz = bucketsz;
map->seed0 = seed0;
Expand All @@ -109,12 +106,11 @@ struct hashmap *hashmap_new_with_allocator(
map->cap = cap;
map->nbuckets = cap;
map->mask = map->nbuckets - 1;
map->buckets = AllocVecTags(map->bucketsz * map->nbuckets, AVT_Type, MEMF_SHARED, TAG_DONE);
map->buckets = AllocVecTags(map->bucketsz * map->nbuckets, AVT_Type, MEMF_SHARED, AVT_ClearWithValue, 0, TAG_DONE);
if (!map->buckets) {
FreeVec(map);
return NULL;
}
ClearMem(map->buckets, map->bucketsz * map->nbuckets);
map->growpower = 1;
map->growat = map->nbuckets * GROW_AT;
map->shrinkat = map->nbuckets * SHRINK_AT;
Expand Down
Loading
Loading