CoreFW  Diff

Differences From Artifact [59f525dc2e]:

To Artifact [12e11ffa26]:


124
125
126
127
128
129
130

















131
132
133
134
135
136
137
138
139
140
141
142

	if (str->cstr != NULL)
		free(str->cstr);

	str->cstr = copy;
	str->len = strlen(copy);


















	return true;
}

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







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












124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

	if (str->cstr != NULL)
		free(str->cstr);

	str->cstr = copy;
	str->len = strlen(copy);

	return true;
}

bool
cfw_string_append(CFWString *str, CFWString *append)
{
	char *new;

	if ((new = realloc(str->cstr, str->len + append->len + 1)) == NULL)
		return false;

	memcpy(new + str->len, append->cstr, append->len);
	new[str->len + append->len] = 0;

	str->cstr = new;
	str->len += append->len;

	return true;
}

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