Differences From Artifact [896b2f634c]:
- File src/OFString+XMLEscaping.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 2449) [annotate] [blame] [check-ins using] [more...]
To Artifact [e1df224af8]:
- File
src/OFString+XMLEscaping.m
— part of check-in
[0ddaac3f5b]
at
2020-11-05 00:24:29
on branch trunk
— Avoid -[allocMemoryWithSize:] for temporary memory
-[allocMemoryWithSize:] has book keeping overhead that is unnecessary
for temporary memory. (user: js, size: 2153) [annotate] [blame] [check-ins using] [more...]
| ︙ | ︙ | |||
38 39 40 41 42 43 44 | OFString *ret; string = self.UTF8String; length = self.UTF8StringLength; j = 0; retLength = length; | < < < < | < < | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
OFString *ret;
string = self.UTF8String;
length = self.UTF8StringLength;
j = 0;
retLength = length;
retCString = of_malloc(retLength, 1);
for (size_t i = 0; i < length; i++) {
switch (string[i]) {
case '<':
append = "<";
appendLen = 4;
break;
|
| ︙ | ︙ | |||
78 79 80 81 82 83 84 |
break;
default:
append = NULL;
appendLen = 0;
}
if (append != NULL) {
| < | | | > | < < < | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
break;
default:
append = NULL;
appendLen = 0;
}
if (append != NULL) {
@try {
retCString = of_realloc(retCString, 1,
retLength + appendLen);
} @catch (id e) {
free(retCString);
@throw e;
}
retLength += appendLen - 1;
memcpy(retCString + j, append, appendLen);
j += appendLen;
} else
retCString[j++] = string[i];
}
|
| ︙ | ︙ |