Overview
Comment: | Add cfw_string_append(). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
891f0add2336272616bf35e7d5564217 |
User & Date: | js on 2012-04-08 19:19:56 |
Other Links: | manifest | tags |
Context
2012-04-08
| ||
19:21 | cstr -> data. check-in: e036a533f1 user: js tags: trunk | |
19:19 | Add cfw_string_append(). check-in: 891f0add23 user: js tags: trunk | |
19:16 | Add -Wall. check-in: 5bb3f2db02 user: js tags: trunk | |
Changes
Modified src/cfwstring.c from [59f525dc2e] to [12e11ffa26].
︙ | |||
124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 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 | + + + + + + + + + + + + + + + + + | 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, |
︙ |
Modified src/cfwstring.h from [3d3ffe349d] to [4630719e18].
︙ | |||
30 31 32 33 34 35 36 37 38 | 30 31 32 33 34 35 36 37 38 39 | + | #include "cfwclass.h" typedef struct CFWString CFWString; extern CFWClass *cfw_string; extern const char* cfw_string_c(CFWString*); extern size_t cfw_string_len(CFWString*); extern bool cfw_string_set(CFWString*, const char*); extern bool cfw_string_append(CFWString*, CFWString*); #endif |
Modified tests/tests.c from [c532ff05d3] to [70b7e88f0b].
︙ | |||
34 35 36 37 38 39 40 | 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 | - + + + + + + + + + + + - + + + | main() { CFWString *s[3]; CFWArray *a; size_t i; s[0] = cfw_new(cfw_string, "Hallo"); |