Skip to content

Commit

Permalink
fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo committed Mar 1, 2024
1 parent 2d4f1f4 commit 8cb4531
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/naughty-buffers/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ NAUGHTY_BUFFERS_EXPORT void nb_remove_at(struct nb_buffer * buffer, size_t index
* equal and > 0 if the first element should come after the second
* @ingroup buffer
*/
NAUGHTY_BUFFERS_EXPORT void nb_sort(const struct nb_buffer * buffer, nb_compare_fn compare_fn);
NAUGHTY_BUFFERS_EXPORT void nb_sort(struct nb_buffer * buffer, nb_compare_fn compare_fn);

/**
* @brief Releases all allocated memory by the buffer and resets all internal metadata effectively making it an
Expand Down
2 changes: 1 addition & 1 deletion src/naughty-buffers/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void nb_remove_at(struct nb_buffer * buffer, const size_t index) {
buffer->block_count--;
}

void nb_sort(struct nb_buffer * buffer, const nb_compare_fn compare_fn) {
void nb_sort(struct nb_buffer * buffer, nb_compare_fn compare_fn) {
qsort(buffer->data, buffer->block_count, buffer->block_size, compare_fn);
}

Expand Down
10 changes: 5 additions & 5 deletions src/naughty-buffers/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@

#include "memory.h"

void * nb_memory_alloc(const size_t memory_size, const void * context) {
void * nb_memory_alloc(const size_t memory_size, void * context) {
(void) context;
return malloc(memory_size);
}

void nb_memory_release(void * ptr, const void * context) {
void nb_memory_release(void * ptr, void * context) {
(void) context;
free(ptr);
}

void * nb_memory_realloc(void * ptr, const size_t memory_size, const void * context) {
void * nb_memory_realloc(void * ptr, const size_t memory_size, void * context) {
(void) context;
return realloc(ptr, memory_size);
}

void * nb_memory_copy(void * destination, const void * source, const size_t size, const void * context) {
void * nb_memory_copy(void * destination, const void * source, const size_t size, void * context) {
(void) context;
return memcpy(destination, source, size);
}

void * nb_memory_move(void * destination, const void * source, const size_t size, const void * context) {
void * nb_memory_move(void * destination, const void * source, const size_t size, void * context) {
(void) context;
return memmove(destination, source, size);
}
10 changes: 5 additions & 5 deletions src/naughty-buffers/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#include "naughty-buffers/naughty-buffers-export.h"

NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_alloc(size_t memory_size, const void * context);
NAUGHTY_BUFFERS_NO_EXPORT void nb_memory_release(void * ptr, const void * context);
NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_realloc(void * ptr, size_t memory_size, const void * context);
NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_copy(void * destination, const void * source, size_t size, const void * context);
NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_move(void * destination, const void * source, size_t size, const void * context);
NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_alloc(size_t memory_size, void * context);
NAUGHTY_BUFFERS_NO_EXPORT void nb_memory_release(void * ptr, void * context);
NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_realloc(void * ptr, size_t memory_size, void * context);
NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_copy(void * destination, const void * source, size_t size, void * context);
NAUGHTY_BUFFERS_NO_EXPORT void * nb_memory_move(void * destination, const void * source, size_t size, void * context);

#endif // NAUGHTY_BUFFERS_MEMORY_H

0 comments on commit 8cb4531

Please sign in to comment.