Fixing cmc_alloc_node_default error

This commit is contained in:
Leonardo committed 2019-11-23 01:46:12 -03:00
1 parent 3ee070b4dd
commit 74177f891d
21 files changed
+107 -72

No files matched your search

+3 -1
View File
@@ -61,7 +61,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -66,7 +66,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -54,7 +54,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -54,7 +54,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -65,7 +65,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -56,7 +56,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -63,7 +63,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -78,7 +78,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -78,7 +78,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -56,7 +56,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -78,7 +78,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -57,7 +57,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -63,7 +63,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -54,7 +54,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+3 -1
View File
@@ -54,7 +54,9 @@ struct cmc_alloc_node
void *(*calloc)(size_t, size_t);
void *(*realloc)(void *, size_t);
void (*free)(void *);
} cmc_alloc_node_default = {malloc, calloc, realloc, free};
};
static struct cmc_alloc_node cmc_alloc_node_default = {malloc, calloc, realloc, free};
#endif /* CMC_CORE_H */
+2 -2
View File
@@ -11,9 +11,9 @@ main: FORCE
./contains.exe
$(CC) types.c -o types.exe $(CFLAGS)
./types.exe
$(CC) -c ./sep/sep.c -o ./sep/sep.o $(CFLAGS)
$(CC) -c ./sep/collections.c -o ./sep/collections.o $(CFLAGS)
$(CC) -c ./sep/main.c -o ./sep/main.o $(CFLAGS)
$(CC) ./sep/sep.o ./sep/main.o -o ./sep/sep.exe
$(CC) ./sep/collections.o ./sep/main.o -o ./sep/sep.exe
./sep/sep.exe
dev: main
+17
View File
@@ -0,0 +1,17 @@
#include "collections.h"
CMC_COLLECTION_GENERATE_SOURCE( BIDIMAP, bm, bmap, int, int)
CMC_COLLECTION_GENERATE_SOURCE( DEQUE, d, deque, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( HASHMAP, hm, hmap, int, int)
CMC_COLLECTION_GENERATE_SOURCE( HASHSET, hs, hset, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( HEAP, h, heap, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(INTERVALHEAP, ih, iheap, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( LINKEDLIST, ll, linked, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( LIST, l, list, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( MULTIMAP, mm, mmap, int, int)
CMC_COLLECTION_GENERATE_SOURCE( MULTISET, ms, mset, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( QUEUE, q, queue, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( SORTEDLIST, sl, slist, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( STACK, s, stack, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( TREESET, ts, tset, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE( TREEMAP, tm, tmap, int, int)
+17
View File
@@ -0,0 +1,17 @@
#include "../../src/macro_collections.h"
CMC_COLLECTION_GENERATE_HEADER( BIDIMAP, bm, bmap, int, int)
CMC_COLLECTION_GENERATE_HEADER( DEQUE, d, deque, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( HASHMAP, hm, hmap, int, int)
CMC_COLLECTION_GENERATE_HEADER( HASHSET, hs, hset, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( HEAP, h, heap, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(INTERVALHEAP, ih, iheap, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( LINKEDLIST, ll, linked, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( LIST, l, list, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( MULTIMAP, mm, mmap, int, int)
CMC_COLLECTION_GENERATE_HEADER( MULTISET, ms, mset, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( QUEUE, q, queue, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( SORTEDLIST, sl, slist, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( STACK, s, stack, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( TREESET, ts, tset, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER( TREEMAP, tm, tmap, int, int)
+26 -23
View File
@@ -1,4 +1,4 @@
#include "sep.h"
#include "collections.h"
#include <stdio.h>
int intcmp(int a, int b)
@@ -20,38 +20,41 @@ size_t inthash(int t)
int main(void)
{
struct list *l = l_new(1000);
struct stack *s = s_new(1000);
struct queue *q = q_new(1000);
struct deque *d = d_new(1000);
struct linked *ll = ll_new();
struct heap *h = h_new(1000, cmc_max_heap, intcmp);
struct tset *ts = ts_new(intcmp);
struct tmap *tm = tm_new(intcmp);
struct hset *hs = hs_new(1000, 0.6, intcmp, inthash);
struct hmap *hm = hm_new(1000, 0.6, intcmp, inthash);
struct iheap *ih = ih_new(1000, intcmp);
struct mmap *mm = mm_new(1000, 0.8, intcmp, inthash);
struct mset *ms = ms_new(1000, 0.6, intcmp, inthash);
struct bmap *bm = bm_new_custom(100, 0.7, NULL, NULL, NULL, NULL, NULL, NULL);
struct deque *d = d_new_custom(100, NULL, NULL);
struct hmap *hm = hm_new_custom(100, 0.6, NULL, NULL, NULL, NULL);
struct hset *hs = hs_new_custom(100, 0.6, NULL, NULL, NULL, NULL);
struct heap *h = h_new_custom(100, cmc_max_heap, NULL, NULL, NULL);
struct iheap *ih = ih_new_custom(100, NULL, NULL, NULL);
struct linked *ll = ll_new_custom(NULL, NULL);
struct list *l = l_new_custom(100, NULL, NULL);
struct mmap *mm = mm_new_custom(100, 0.8, NULL, NULL, NULL, NULL);
struct mset *ms = ms_new_custom(100, 0.6, NULL, NULL, NULL, NULL);
struct queue *q = q_new_custom(100, NULL, NULL);
struct slist *sl = sl_new_custom(100, NULL, NULL, NULL);
struct stack *s = s_new_custom(100, NULL, NULL);
struct tmap *tm = tm_new_custom(NULL, NULL, NULL);
struct tset *ts = ts_new_custom(NULL, NULL, NULL);
printf("+--------------------------------------------------+\n");
printf("| Separate Header and Source is Working |\n");
printf("+--------------------------------------------------+\n");
l_free(l, NULL);
ll_free(ll, NULL);
s_free(s, NULL);
q_free(q, NULL);
bm_free(bm, NULL);
d_free(d, NULL);
h_free(h, NULL);
ts_free(ts, NULL);
tm_free(tm, NULL);
hs_free(hs, NULL);
hm_free(hm, NULL);
hs_free(hs, NULL);
h_free(h, NULL);
ih_free(ih, NULL);
ll_free(ll, NULL);
l_free(l, NULL);
mm_free(mm, NULL);
ms_free(ms, NULL);
q_free(q, NULL);
sl_free(sl, NULL);
s_free(s, NULL);
tm_free(tm, NULL);
ts_free(ts, NULL);
return 0;
}
-16
View File
@@ -1,16 +0,0 @@
#include "sep.h"
CMC_COLLECTION_GENERATE_SOURCE(LIST, l, list, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(STACK, s, stack, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(QUEUE, q, queue, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(DEQUE, d, deque, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(LINKEDLIST, ll, linked, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(HEAP, h, heap, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(TREESET, ts, tset, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(TREEMAP, tm, tmap, int, int)
CMC_COLLECTION_GENERATE_SOURCE(HASHSET, hs, hset, /* K */, int)
CMC_COLLECTION_GENERATE_SOURCE(HASHMAP, hm, hmap, int, int)
CMC_COLLECTION_GENERATE_SOURCE(INTERVALHEAP, ih, iheap, , int)
CMC_COLLECTION_GENERATE_SOURCE(MULTIMAP, mm, mmap, int, int)
CMC_COLLECTION_GENERATE_SOURCE(MULTISET, ms, mset, , int)
-16
View File
@@ -1,16 +0,0 @@
#include "../../src/macro_collections.h"
CMC_COLLECTION_GENERATE_HEADER(LIST, l, list, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(STACK, s, stack, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(QUEUE, q, queue, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(DEQUE, d, deque, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(LINKEDLIST, ll, linked, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(HEAP, h, heap, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(TREESET, ts, tset, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(TREEMAP, tm, tmap, int, int)
CMC_COLLECTION_GENERATE_HEADER(HASHSET, hs, hset, /* K */, int)
CMC_COLLECTION_GENERATE_HEADER(HASHMAP, hm, hmap, int, int)
CMC_COLLECTION_GENERATE_HEADER(INTERVALHEAP, ih, iheap, , int)
CMC_COLLECTION_GENERATE_HEADER(MULTIMAP, mm, mmap, int, int)
CMC_COLLECTION_GENERATE_HEADER(MULTISET, ms, mset, , int)