POLY: add delete_polynom() function

This deletes both the internal structure and the pointer.
This commit is contained in:
hasufell 2014-04-15 14:22:46 +02:00
parent b33b0c6b1a
commit 4a7e50a194
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 16 additions and 0 deletions

View File

@ -74,6 +74,20 @@ void init_polynom_size(pb_poly *new_poly, mp_int *chara, int size)
}
}
/**
* This deletes the internal structure of a polynomial,
* and frees the pointer. Don't call this on stack variables,
* this is intended for use after ntru_ functions, that
* return a polynomial pointer.
*
* @param poly the polynomial to delete
*/
void delete_polynom(pb_poly *poly)
{
pb_clear(poly);
free(poly);
}
/**
* Print the polynomial in a human readable format to stdout.
*

View File

@ -33,6 +33,8 @@ void init_polynom(pb_poly *new_poly, mp_int *chara);
void init_polynom_size(pb_poly *new_poly, mp_int *chara, int size);
void delete_polynom(pb_poly *new_poly);
void draw_polynom(pb_poly * const poly);
#endif /* NTRU_POLY_H */