goto编译错误,error: expected ‘;’ before ‘:’ token

int init_flow_spd_upload_que(int threadnum)
{
    int i = 0;

    flow_spd_stat_que_t *flow_spd_stat_que;

    for(i = 0; i < threadnum; i++)
    {
        flow_spd_stat_que = malloc(sizeof(flow_spd_stat_que_t) + 
            (sizeof(flow_proc_data_t)) * s_spd_upload_que_mcnt);
       
        if(!flow_spd_stat_que)
        {
            goto FAIL_FLOW_SPD;
        }
        flow_spd_stat_ques[i] = flow_spd_stat_que;
    }

    for(i = 0; i < threadnum; i++)
    {
        flow_spd_stat_ques[i]->que_size = s_spd_upload_que_mcnt;
        flow_spd_stat_ques[i]->que_tail = 0;
        flow_spd_stat_ques[i]->que_head = 0;
        flow_spd_stat_ques[i]->que_drop1 = 0;
        flow_spd_stat_ques[i]->que_drop2 = 0;
        flow_spd_stat_ques[i]->que_add = 0;
        flow_spd_stat_ques[i]->que_proc = 0;
    }

    return 0;

FAIL_FLOW_SPD:
    for(i = 0; i < threadnum; i++)
    {
        if(flow_spd_stat_ques[i])
        {
            free(flow_spd_stat_ques[i]);
            flow_spd_stat_ques[i] = NULL;
        }
    }
    
    return -1;
}


如果

FAIL_FLOW_SPD在其他goto中也有相同变量,编译报错error: expected ‘;’ before ‘:’ token

你可能感兴趣的:(C/C++)