41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
j = 0;
retLength = length;
/*
* We can't use allocMemoryWithSize: here as it might be a @"" literal
*/
if ((retCString = malloc(retLength)) == NULL)
@throw [OFOutOfMemoryException exceptionWithClass: isa
requestedSize: retLength];
for (i = 0; i < length; i++) {
switch (string[i]) {
case '<':
append = "<";
appendLen = 4;
|
|
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
j = 0;
retLength = length;
/*
* We can't use allocMemoryWithSize: here as it might be a @"" literal
*/
if ((retCString = malloc(retLength)) == NULL)
@throw [OFOutOfMemoryException exceptionWithClass: [self class]
requestedSize: retLength];
for (i = 0; i < length; i++) {
switch (string[i]) {
case '<':
append = "<";
appendLen = 4;
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
if (append != NULL) {
char *newRetCString;
if ((newRetCString = realloc(retCString,
retLength + appendLen)) == NULL) {
free(retCString);
@throw [OFOutOfMemoryException
exceptionWithClass: isa
requestedSize: retLength + appendLen];
}
retCString = newRetCString;
retLength += appendLen - 1;
memcpy(retCString + j, append, appendLen);
j += appendLen;
|
|
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
if (append != NULL) {
char *newRetCString;
if ((newRetCString = realloc(retCString,
retLength + appendLen)) == NULL) {
free(retCString);
@throw [OFOutOfMemoryException
exceptionWithClass: [self class]
requestedSize: retLength + appendLen];
}
retCString = newRetCString;
retLength += appendLen - 1;
memcpy(retCString + j, append, appendLen);
j += appendLen;
|