[PATCH] local-factoring on TREE-SSA

Andrew Pinski pinskia@physics.uc.edu
Wed Jul 21 01:55:00 GMT 2004


On Jul 20, 2004, at 1:21 PM, James A. Morrison wrote:
>> +static bb_decorator
>> +init_factoring (bb_decorator decorator)
>> +{
>> +  basic_block bb;
>> +  int out_of_mem = 0;
>> +
>> +  bb_decorator last = NULL;
>> +  FOR_EACH_BB (bb)
>> +  {
>> +    bb_decorator temp;
>> +
>> +    temp =
>> +      (struct bb_decorator_def *) xmalloc (sizeof (struct 
>> bb_decorator_def));
>
>  You can use calloc instead of malloc + memset.
>
>> +    if (!temp)
>> +      {
>> +        out_of_mem = 1;
>> +        break;
>> +      }
>> +    memset (temp, 0, sizeof (*temp));
>>


And one more thing xmalloc will just fail aka abort the program
if you run out of space so you do not have to worry about the return
value of xmalloc being a valid pointer.

Andrew



More information about the Gcc-patches mailing list