STRING: provide function for deleting strings

This commit is contained in:
hasufell 2014-05-26 21:38:39 +02:00
parent 4dbfe1e663
commit ff3967f932
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
3 changed files with 24 additions and 1 deletions

View File

@ -37,7 +37,8 @@ endif
LIBS += -L. -lgmp -lmpfr -lm LIBS += -L. -lgmp -lmpfr -lm
# objects # objects
PQC_OBJS = poly.o mem.o encrypt.o decrypt.o keypair.o ascii_poly.o file.o PQC_OBJS = poly.o mem.o encrypt.o decrypt.o keypair.o ascii_poly.o file.o \
ntru_string.o
PQC_HEADERS = err.h poly.h context.h encrypt.h decrypt.h keypair.h \ PQC_HEADERS = err.h poly.h context.h encrypt.h decrypt.h keypair.h \
ascii_poly.h common.h file.h ntru_string.h ascii_poly.h common.h file.h ntru_string.h
# CUNIT_OBJS = cunit.o # CUNIT_OBJS = cunit.o

View File

@ -25,3 +25,13 @@
* like C strings and provides operations on it. * like C strings and provides operations on it.
* @brief string type and operations * @brief string type and operations
*/ */
#include "ntru_string.h"
void
string_delete(string *del_string)
{
free(del_string->ptr);
free(del_string);
}

View File

@ -51,4 +51,16 @@ struct string {
}; };
/**
* Delete the inner structure
* of the string and frees the string
* itself from the heap. Must not be
* called on stack variables.
*
* @param del_string the string to delete
*/
void
string_delete(string *del_string);
#endif /* NTRU_STRING_H */ #endif /* NTRU_STRING_H */