'
This commit is contained in:
parent
ac1b94ebc1
commit
7629201717
4 changed files with 20 additions and 5 deletions
|
|
@ -1,15 +1,17 @@
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=
|
CFLAGS=-std=c99 -pedantic -Werror -Wall -Wextra -Wvla -fvisibility=hidden -fPIC
|
||||||
LDFLAGS=
|
CPPFLAGS=D_DEFAULT_SOURCE
|
||||||
|
LDFLAGS= -shared -Wl --no-undefined
|
||||||
|
|
||||||
SRCS=
|
SRCS=
|
||||||
OBJS=${SRC:.c=.o}
|
OBJS=${SRC:.c=.o}
|
||||||
TARGET=libmalloc.so
|
TARGET=libmalloc.so
|
||||||
|
|
||||||
library: $(OBJS)
|
library: $(OBJS)
|
||||||
$(CC) -shared -o $(TARGET) $^
|
$(CC) -o $(TARGET) $^
|
||||||
|
|
||||||
debug:
|
debug: $(OBJS) $(TST_OBJS)
|
||||||
|
$(CC) -o $(TST_TARGET) $^
|
||||||
|
|
||||||
check:
|
check:
|
||||||
|
|
||||||
|
|
|
||||||
4
malloc/src/helpers/helpers.c
Normal file
4
malloc/src/helpers/helpers.c
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#include "helpers.h"
|
||||||
|
|
||||||
|
size_t get_next_2power(size_t n)
|
||||||
|
{}
|
||||||
8
malloc/src/helpers/helpers.h
Normal file
8
malloc/src/helpers/helpers.h
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef HELPERS_H
|
||||||
|
#define HELPERS_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
size_t get_next_2power(size_t n);
|
||||||
|
|
||||||
|
#endif // ! HELPERS_H
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
__attribute__((visibility("default"))) void *malloc(size_t size)
|
__attribute__((visibility("default"))) void *malloc(size_t size)
|
||||||
{
|
{
|
||||||
return NULL;
|
if (size == 0)
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((visibility("default"))) void free(void *ptr)
|
__attribute__((visibility("default"))) void free(void *ptr)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue