Skip to content

Commit

Permalink
[ops] Fixed some compiler warnings by casting malloc() results.
Browse files Browse the repository at this point in the history
  • Loading branch information
chromatic committed Oct 8, 2009
1 parent 30e2cfd commit 10069b6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ops/perl6.ops
Expand Up @@ -393,19 +393,20 @@ Sets $1 to be a P6LowLevelSig with $2 signature elements allocated.
inline op allocate_signature(out PMC, in INT) :base_core {
struct llsig_element **elements;
INTVAL i;

/* Create new low level signature PMC. */
if (!lls_id)
lls_id = pmc_type(interp, string_from_literal(interp, "P6LowLevelSig"));
$1 = pmc_new(interp, lls_id);

/* Allocate required amount of structs. */
elements = mem_sys_allocate(($2 + 1) * sizeof(llsig_element *));
elements = (struct llsig_element **)mem_sys_allocate(($2 + 1) * sizeof(llsig_element *));

for (i = 0; i < $2; i++)
elements[i] = mem_sys_allocate_zeroed(sizeof(llsig_element));
elements[i] = (llsig_element *)mem_sys_allocate_zeroed(sizeof(llsig_element));
elements[$2] = NULL;
SETATTR_P6LowLevelSig_elements(interp, $1, elements);

/* Stash size. */
SETATTR_P6LowLevelSig_num_elements(interp, $1, $2);

Expand Down

0 comments on commit 10069b6

Please sign in to comment.