Skip to content

Commit

Permalink
yay size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
gafferongames committed Dec 26, 2023
1 parent bd671e9 commit 30c1407
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions reliable.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void reliable_printf( int level, RELIABLE_CONST char * format, ... )

#endif // #if RELIABLE_ENABLE_LOGGING

void * reliable_default_allocate_function( void * context, uint64_t bytes )
void * reliable_default_allocate_function( void * context, size_t bytes )
{
(void) context;
return malloc( bytes );
Expand Down Expand Up @@ -138,7 +138,7 @@ int reliable_sequence_less_than( uint16_t s1, uint16_t s2 )
struct reliable_sequence_buffer_t
{
void * allocator_context;
void * (*allocate_function)(void*,uint64_t);
void * (*allocate_function)(void*,size_t);
void (*free_function)(void*,void*);
uint16_t sequence;
int num_entries;
Expand All @@ -150,7 +150,7 @@ struct reliable_sequence_buffer_t
struct reliable_sequence_buffer_t * reliable_sequence_buffer_create( int num_entries,
int entry_stride,
void * allocator_context,
void * (*allocate_function)(void*,uint64_t),
void * (*allocate_function)(void*,size_t),
void (*free_function)(void*,void*) )
{
reliable_assert( num_entries > 0 );
Expand Down Expand Up @@ -503,7 +503,7 @@ void reliable_fragment_reassembly_data_cleanup( void * data, void * allocator_co
struct reliable_endpoint_t
{
void * allocator_context;
void * (*allocate_function)(void*,uint64_t);
void * (*allocate_function)(void*,size_t);
void (*free_function)(void*,void*);
struct reliable_config_t config;
double time;
Expand Down Expand Up @@ -576,7 +576,7 @@ struct reliable_endpoint_t * reliable_endpoint_create( struct reliable_config_t
reliable_assert( config->process_packet_function != NULL );

void * allocator_context = config->allocator_context;
void * (*allocate_function)(void*,uint64_t) = config->allocate_function;
void * (*allocate_function)(void*,size_t) = config->allocate_function;
void (*free_function)(void*,void*) = config->free_function;

if ( allocate_function == NULL )
Expand Down Expand Up @@ -2265,7 +2265,7 @@ struct test_tracking_allocate_context_t
void* active_allocations[1024];
};

void * test_tracking_allocate_function( void * context, uint64_t bytes )
void * test_tracking_allocate_function( void * context, size_t bytes )
{
struct test_tracking_allocate_context_t* tracking_context = (struct test_tracking_allocate_context_t*)context;
void * allocation = malloc( bytes );
Expand Down
4 changes: 3 additions & 1 deletion reliable.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#define RELIABLE_H

#include <stdint.h>
#include <stddef.h>
#include <inttypes.h>

#if !defined(RELIABLE_DEBUG) && !defined(RELIABLE_RELEASE)
#if defined(NDEBUG)
Expand Down Expand Up @@ -110,7 +112,7 @@ struct reliable_config_t
void (*transmit_packet_function)(void*,int,uint16_t,uint8_t*,int);
int (*process_packet_function)(void*,int,uint16_t,uint8_t*,int);
void * allocator_context;
void * (*allocate_function)(void*,uint64_t);
void * (*allocate_function)(void*,size_t);
void (*free_function)(void*,void*);
};

Expand Down

0 comments on commit 30c1407

Please sign in to comment.