32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
|
struct CFWString {
CFWObject obj;
char *cstr;
size_t len;
};
static void
ctor(void *ptr)
static bool
ctor(void *ptr, va_list args)
{
CFWString *str = ptr;
const char *cstr = va_arg(args, const char*);
if (cstr != NULL) {
if ((str->cstr = strdup(cstr)) == NULL)
return false;
str->len = strlen(cstr);
} else {
str->cstr = NULL;
str->len = 0;
str->cstr = NULL;
str->len = 0;
}
return true;
}
static void
dtor(void *ptr)
{
CFWString *str = ptr;
|