CoreFW  Check-in [c9caa75847]

Overview
Comment:Use (void*)NULL instead of NULL in varargs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c9caa75847d7e1d1d25819f99391f311d8930ef7563789e98198e8fdb4bdc120
User & Date: js on 2013-06-08 09:47:14
Other Links: manifest | tags
Context
2014-07-07
22:46
Add missing definition of _C99_SOURCE Leaf check-in: e1f08057a2 user: js tags: trunk
2013-06-08
09:47
Use (void*)NULL instead of NULL in varargs. check-in: c9caa75847 user: js tags: trunk
2012-09-30
03:40
Allow appending NULL to strings. check-in: 1adab684f6 user: js tags: trunk
Changes

Modified src/array.c from [ce9d8b0bdd] to [f6b32ef392].

109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123







-
+







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

	if ((new = cfw_new(cfw_array, NULL)) == NULL)
	if ((new = cfw_new(cfw_array, (void*)NULL)) == NULL)
		return NULL;

	if ((new->data = malloc(sizeof(void*) * array->size)) == NULL) {
		cfw_unref(new);
		return NULL;
	}
	new->size = array->size;

Modified src/class.h from [263717fe7a] to [00840273ae].

31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45







-
+







#include <stdbool.h>
#include <stdint.h>
#include <stdarg.h>

typedef struct CFWClass {
	const char *name;
	size_t size;
	bool (*ctor)(void*, va_list args);
	bool (*ctor)(void*, va_list);
	void (*dtor)(void*);
	bool (*equal)(void*, void*);
	uint32_t (*hash)(void*);
	void* (*copy)(void*);
} CFWClass;

extern const char* cfw_class_name(CFWClass*);

Modified src/map.c from [01e60939fa] to [19a6d5c8ea].

122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
122
123
124
125
126
127
128

129
130
131
132
133
134
135
136







-
+







static void*
copy(void *ptr)
{
	CFWMap *map = ptr;
	CFWMap *new;
	uint32_t i;

	if ((new = cfw_new(cfw_map, NULL)) == NULL)
	if ((new = cfw_new(cfw_map, (void*)NULL)) == NULL)
		return NULL;

	if ((new->data = malloc(sizeof(*new->data) * map->size)) == NULL)
		return NULL;
	new->size = map->size;

	for (i = 0; i < map->size; i++) {

Modified src/stream.c from [765c2b0a12] to [79f2ab99f2].

109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123







-
+







				if (i > 0 && stream->cache[i - 1] == '\r')
					ret_len--;

				ret_str = cfw_strndup(stream->cache, ret_len);
				if (ret_str == NULL)
					return NULL;

				ret = cfw_create(cfw_string, NULL);
				ret = cfw_create(cfw_string, (void*)NULL);
				if (ret == NULL) {
					free(ret_str);
					return NULL;
				}
				cfw_string_set_nocopy(ret, ret_str, ret_len);

				if (stream->cache_len > i + 1) {
155
156
157
158
159
160
161
162

163
164
165
166
167
168
169
155
156
157
158
159
160
161

162
163
164
165
166
167
168
169







-
+







			if (ret_len > 0 && stream->cache[ret_len - 1] == '\r')
				ret_len--;

			ret_str = cfw_strndup(stream->cache, ret_len);
			if (ret_str == NULL)
				return NULL;

			ret = cfw_create(cfw_string, NULL);
			ret = cfw_create(cfw_string, (void*)NULL);
			if (ret == NULL) {
				free(ret_str);
				return NULL;
			}
			cfw_string_set_nocopy(ret, ret_str, ret_len);

			free(stream->cache);
195
196
197
198
199
200
201
202

203
204
205
206
207
208
209
195
196
197
198
199
200
201

202
203
204
205
206
207
208
209







-
+







				memcpy(ret_str, stream->cache,
				    stream->cache_len);
				memcpy(ret_str + stream->cache_len, buf, i);
				if (ret_len > 0 && ret_str[ret_len - 1] == '\r')
					ret_len--;
				ret_str[ret_len] = '\0';

				ret = cfw_create(cfw_string, NULL);
				ret = cfw_create(cfw_string, (void*)NULL);
				if (ret == NULL) {
					free(buf);
					free(ret_str);
					return NULL;
				}
				cfw_string_set_nocopy(ret, ret_str, ret_len);

Modified src/string.c from [50cffdfc15] to [287c38190e].

150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164







-
+








static void*
copy(void *ptr)
{
	CFWString *str = ptr;
	CFWString *new;

	if ((new = cfw_new(cfw_string, NULL)) == NULL)
	if ((new = cfw_new(cfw_string, (void*)NULL)) == NULL)
		return NULL;

	if ((new->data = malloc(str->len + 1)) == NULL) {
		cfw_unref(new);
		return NULL;
	}
	new->len = str->len;