CoreFW  Check-in [bdb850f3e2]

Overview
Comment:ctor: Set pointers to NULL before allocation.

This way, the dtor can work correctly.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bdb850f3e2932b22bbefc1a8dc76d7e801fe0ac3a80a00228f47dbb31e2bce79
User & Date: js on 2012-04-22 02:34:50
Other Links: manifest | tags
Context
2012-04-22
02:34
Add missing NULL. check-in: c3a601908a user: js tags: trunk
02:34
ctor: Set pointers to NULL before allocation. check-in: bdb850f3e2 user: js tags: trunk
2012-04-09
14:06
Add hashing. check-in: a2613e09be user: js tags: trunk
Changes

Modified src/string.c from [415ab5e653] to [5092f0f99a].

41
42
43
44
45
46
47

48
49
50
51
52
53
54
static bool
ctor(void *ptr, va_list args)
{
	CFWString *str = ptr;
	const char *cstr = va_arg(args, const char*);

	if (cstr != NULL) {

		if ((str->data = strdup(cstr)) == NULL)
			return false;

		str->len = strlen(cstr);
	} else {
		str->data = NULL;
		str->len = 0;







>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
static bool
ctor(void *ptr, va_list args)
{
	CFWString *str = ptr;
	const char *cstr = va_arg(args, const char*);

	if (cstr != NULL) {
		str->data = NULL;
		if ((str->data = strdup(cstr)) == NULL)
			return false;

		str->len = strlen(cstr);
	} else {
		str->data = NULL;
		str->len = 0;