/************************************************************************* * * Function: lpc_init * ************************************************************************** */ int lpc_init (lpcState **state) { lpcState* s; if (state == (lpcState **) NULL){ fprintf(stderr, "lpc_init: invalid parameter\n"); return -1; } *state = NULL; /* allocate memory */ if ((s= (lpcState *) malloc(sizeof(lpcState))) == NULL){ fprintf(stderr, "lpc_init: can not malloc state structure\n"); return -1; } s->levinsonSt = NULL; /* Init sub states */ if (Levinson_init(&s->levinsonSt)) { lpc_exit(&s); return -1; } lpc_reset(s); *state = s; return 0; }
/************************************************************************* * * Function: lpc_init * ************************************************************************** */ int lpc_init (lpcState *state) { if (state == (lpcState *) NULL){ fprintf(stderr, "lpc_init: invalid parameter\n"); return -1; } /* Init sub states */ if (Levinson_init(&state->levinsonSt)) { lpc_reset(state); return -1; } lpc_reset(state); return 0; }