Skip to content

Commit

Permalink
Support compiling with Pelles C (#109)
Browse files Browse the repository at this point in the history
* Support compiling with Pelles C (#108)
* Update bench.c to avoid errors from strict c++ compilers
* Update .gitignore
  • Loading branch information
spaskalev authored Jun 14, 2024
1 parent e3c89e7 commit 0d0e118
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@ dkms.conf
*.static

# Perf
bench
bench

# cmake output dir
out/*

# visual studio metadata
.vs/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This is a buddy memory allocator that might be suitable for use in applications
- 100% line and branch test coverage
- Supports 32-bit and 64-bit platforms
- Endian-agnostic, works on both LE and BE
- Compiles with GCC, Clang and MSVC
- Compiles with GCC, Clang, MSVC and Pelles C

## Usage

Expand Down
4 changes: 2 additions & 2 deletions bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ int main() {
setvbuf(stdout, NULL, _IONBF, 0);

size_t arena_size = 1 << 30;
unsigned char *buddy_buf = malloc(buddy_sizeof_alignment(arena_size, 64));
unsigned char *data_buf = malloc(arena_size);
unsigned char *buddy_buf = (unsigned char *) malloc(buddy_sizeof_alignment(arena_size, 64));
unsigned char *data_buf = (unsigned char *) malloc(arena_size);
struct buddy *buddy = buddy_init_alignment(buddy_buf, data_buf, arena_size, 64);

double total = 0;
Expand Down
11 changes: 11 additions & 0 deletions buddy_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ typedef signed long ssize_t;
#define _SSIZE_T_DEFINED
#endif

/* Support compiling with Pelles C */
#if defined(__POCC__) && defined(__POCC_TARGET__)
#if __POCC_TARGET__ == 3
typedef signed long long ssize_t;
#elif __POCC_TARGET__ == 1
typedef signed long ssize_t;
#else
#error Uknown POCC target
#endif
#endif

#ifndef BUDDY_PRINTF
#define BUDDY_PRINTF printf
#endif
Expand Down

0 comments on commit 0d0e118

Please sign in to comment.