CoreFW  Diff

Differences From Artifact [0c97dcdd1f]:

To Artifact [203632d233]:


25
26
27
28
29
30
31

32
33
34
35
36
37
38
 */

#include <stdlib.h>
#include <stdint.h>

#include "object.h"
#include "array.h"


struct CFWArray {
	CFWObject obj;
	void **data;
	size_t size;
};








>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 */

#include <stdlib.h>
#include <stdint.h>

#include "object.h"
#include "array.h"
#include "hash.h"

struct CFWArray {
	CFWObject obj;
	void **data;
	size_t size;
};

83
84
85
86
87
88
89

















90
91
92
93
94
95
96

	for (i = 0; i < array1->size; i++)
		if (cfw_equal(array1->data[i], array2->data[i]))
			return false;

	return true;
}


















static void*
copy(void *ptr)
{
	CFWArray *array = ptr;
	CFWArray *new;
	size_t i;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

	for (i = 0; i < array1->size; i++)
		if (cfw_equal(array1->data[i], array2->data[i]))
			return false;

	return true;
}

static uint32_t
hash(void *ptr)
{
	CFWArray *array = ptr;
	size_t i;
	uint32_t hash;

	CFW_HASH_INIT(hash);

	for (i = 0; i < array->size; i++)
		CFW_HASH_ADD_HASH(hash, cfw_hash(array->data[i]));

	CFW_HASH_FINALIZE(hash);

	return hash;
}

static void*
copy(void *ptr)
{
	CFWArray *array = ptr;
	CFWArray *new;
	size_t i;
254
255
256
257
258
259
260

261
262
263

static CFWClass class = {
	.name = "CFWArray",
	.size = sizeof(CFWArray),
	.ctor = ctor,
	.dtor = dtor,
	.equal = equal,

	.copy = copy
};
CFWClass *cfw_array = &class;







>



272
273
274
275
276
277
278
279
280
281
282

static CFWClass class = {
	.name = "CFWArray",
	.size = sizeof(CFWArray),
	.ctor = ctor,
	.dtor = dtor,
	.equal = equal,
	.hash = hash,
	.copy = copy
};
CFWClass *cfw_array = &class;