Issue #206 (bdwgc).
* cord/cordbscs.c (Concatenation, Function, Generic): Define struct
outside union (i.e. the union just uses them).
* cord/cordbscs.c (CORD_cat_char_star, CORD_from_fn_inner,
CORD_substr_checked): Cast GC_MALLOC_ATOMIC() result to char*.
* cord/cordprnt.c (CORD_vsprintf): Likewise.
* cord/cordxtra.c (CORD_cat_char, CORD_to_char_star,
CORD_from_char_star, CORD_ec_flush_buf): Likewise.
* cord/cordbscs.c (CORD_substr_checked): Remove register keyword for
"result" local variable.
typedef unsigned long word;
-typedef union {
struct Concatenation {
char null;
char header;
word len;
CORD left; /* length(left) > 0 */
CORD right; /* length(right) > 0 */
- } concatenation;
+ };
+
struct Function {
char null;
char header;
word len;
CORD_fn fn;
void * client_data;
- } function;
+ };
+
struct Generic {
char null;
char header;
char depth;
char left_len;
word len;
- } generic;
+ };
+
+typedef union {
+ struct Concatenation concatenation;
+ struct Function function;
+ struct Generic generic;
char string[1];
} CordRep;
lenx = strlen(x);
result_len = lenx + leny;
if (result_len <= SHORT_LIMIT) {
- register char * result = GC_MALLOC_ATOMIC(result_len+1);
+ char * result = (char *)GC_MALLOC_ATOMIC(result_len + 1);
if (result == 0) OUT_OF_MEMORY;
memcpy(result, x, lenx);
}
result_len = right_len + leny; /* length of new_right */
if (result_len <= SHORT_LIMIT) {
- new_right = GC_MALLOC_ATOMIC(result_len + 1);
+ new_right = (char *)GC_MALLOC_ATOMIC(result_len + 1);
if (new_right == 0) OUT_OF_MEMORY;
memcpy(new_right, right, right_len);
memcpy(new_right + right_len, y, leny);
buf[i] = c;
}
- result = GC_MALLOC_ATOMIC(len+1);
+ result = (char *)GC_MALLOC_ATOMIC(len + 1);
if (result == 0) OUT_OF_MEMORY;
memcpy(result, buf, len);
result[len] = '\0';
if (n > SUBSTR_LIMIT) {
return(CORD_substr_closure(x, i, n, CORD_index_access_fn));
} else {
- register char * result = GC_MALLOC_ATOMIC(n+1);
+ char * result = (char *)GC_MALLOC_ATOMIC(n + 1);
if (result == 0) OUT_OF_MEMORY;
strncpy(result, x+i, n);
}
*p++ = c;
}
- result = GC_MALLOC_ATOMIC(n+1);
+ result = (char *)GC_MALLOC_ATOMIC(n + 1);
if (result == 0) OUT_OF_MEMORY;
memcpy(result, buf, n);
result[n] = '\0';
len = (unsigned)prec;
}
if (width != NONE && len < (size_t)width) {
- char * blanks = GC_MALLOC_ATOMIC(width-len+1);
+ char * blanks =
+ (char *)GC_MALLOC_ATOMIC(width - len + 1);
if (NULL == blanks) OUT_OF_MEMORY;
memset(blanks, ' ', width-len);
if (prec != NONE && prec > max_size) max_size = prec;
max_size += CONV_RESULT_LEN;
if (max_size >= CORD_BUFSZ) {
- buf = GC_MALLOC_ATOMIC(max_size + 1);
+ buf = (char *)GC_MALLOC_ATOMIC(max_size + 1);
if (NULL == buf) OUT_OF_MEMORY;
} else {
if (CORD_BUFSZ - (result[0].ec_bufptr-result[0].ec_buf)
register char * string;
if (c == '\0') return(CORD_cat(x, CORD_nul(1)));
- string = GC_MALLOC_ATOMIC(2);
+ string = (char *)GC_MALLOC_ATOMIC(2);
if (string == 0) OUT_OF_MEMORY;
string[0] = c;
string[1] = '\0';
char * CORD_to_char_star(CORD x)
{
register size_t len = CORD_len(x);
- char * result = GC_MALLOC_ATOMIC(len + 1);
+ char * result = (char *)GC_MALLOC_ATOMIC(len + 1);
if (result == 0) OUT_OF_MEMORY;
if (len > 0 && CORD_fill_buf(x, 0, len, result) != 1)
size_t len = strlen(s);
if (0 == len) return(CORD_EMPTY);
- result = GC_MALLOC_ATOMIC(len + 1);
+ result = (char *)GC_MALLOC_ATOMIC(len + 1);
if (result == 0) OUT_OF_MEMORY;
memcpy(result, s, len+1);
return(result);
char * s;
if (len == 0) return;
- s = GC_MALLOC_ATOMIC(len+1);
+ s = (char *)GC_MALLOC_ATOMIC(len + 1);
if (NULL == s) OUT_OF_MEMORY;
memcpy(s, x[0].ec_buf, len);
s[len] = '\0';