Skip to content

Commit 6bf87d9

Browse files
committed
Allow the buffered objects to be something other than a pointer.
1 parent d0a290c commit 6bf87d9

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

buffer.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#include <stdlib.h>
77

88
#define BUFFER_SIZE 128
9-
static BUFFER_TYPE *buffered_object_buffer[BUFFER_SIZE];
10-
static BUFFER_TYPE **buffered_object_overflow;
9+
static BUFFER_TYPE buffered_object_buffer[BUFFER_SIZE];
10+
static BUFFER_TYPE *buffered_object_overflow;
1111
static int buffered_objects;
1212
static int buffered_object_overflow_space;
1313

14-
static void set_buffered_object_at_index(BUFFER_TYPE *cat, unsigned int i)
14+
static void set_buffered_object_at_index(BUFFER_TYPE cat, unsigned int i)
1515
{
1616
if (i < BUFFER_SIZE)
1717
{
@@ -23,20 +23,20 @@ static void set_buffered_object_at_index(BUFFER_TYPE *cat, unsigned int i)
2323
if (NULL == buffered_object_overflow)
2424
{
2525
buffered_object_overflow =
26-
calloc(BUFFER_SIZE, sizeof(BUFFER_TYPE*));
26+
calloc(BUFFER_SIZE, sizeof(BUFFER_TYPE));
2727
buffered_object_overflow_space = BUFFER_SIZE;
2828
}
2929
while (i >= buffered_object_overflow_space)
3030
{
3131
buffered_object_overflow_space <<= 1;
3232
buffered_object_overflow = realloc(buffered_object_overflow,
33-
buffered_object_overflow_space * sizeof(BUFFER_TYPE*));
33+
buffered_object_overflow_space * sizeof(BUFFER_TYPE));
3434
}
3535
buffered_object_overflow[i] = cat;
3636
}
3737
}
3838

39-
static BUFFER_TYPE *buffered_object_at_index(unsigned int i)
39+
static BUFFER_TYPE buffered_object_at_index(unsigned int i)
4040
{
4141
if (i<BUFFER_SIZE)
4242
{
@@ -52,7 +52,7 @@ static void compact_buffer(void)
5252
unsigned insert = 0;
5353
for (unsigned i=0 ; i<size ; i++)
5454
{
55-
BUFFER_TYPE *c = buffered_object_at_index(i);
55+
BUFFER_TYPE c = buffered_object_at_index(i);
5656
if (c != NULL)
5757
{
5858
set_buffered_object_at_index(c, insert++);

category_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "loader.h"
55
#include "dtable.h"
66

7-
#define BUFFER_TYPE struct objc_category
7+
#define BUFFER_TYPE struct objc_category *
88
#include "buffer.h"
99

1010
void objc_send_load_message(Class class);

protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "lock.h"
66
#include <stdlib.h>
77

8-
#define BUFFER_TYPE struct objc_protocol_list
8+
#define BUFFER_TYPE struct objc_protocol_list *
99
#include "buffer.h"
1010

1111
// Get the functions for string hashing

statics_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "constant_string.h"
66
#include "visibility.h"
77

8-
#define BUFFER_TYPE struct objc_static_instance_list
8+
#define BUFFER_TYPE struct objc_static_instance_list *
99
#include "buffer.h"
1010

1111
static BOOL try_init_statics(struct objc_static_instance_list *statics)

0 commit comments

Comments
 (0)