add function locked_list_destroy

posix_api
YuQing 2022-03-01 15:03:22 +08:00
parent c9cba5298a
commit 1cb1847b29
3 changed files with 20 additions and 18 deletions

View File

@ -24,6 +24,11 @@ extern "C" {
return 0;
}
static inline void locked_list_destroy(FCLockedList *list)
{
pthread_mutex_destroy(&list->lock);
}
static inline void locked_list_add(struct fc_list_head *_new,
FCLockedList *list)
{

View File

@ -337,20 +337,17 @@ int my_md5_file(char *filename,unsigned char digest[16])
FILE *file;
MD5_CTX context;
int len;
unsigned char buffer[1024];
unsigned char buff[16 * 1024];
if ((file = fopen(filename, "rb")) == NULL)
if ((file = fopen(filename, "rb")) == NULL) {
return -1;
else {
}
my_md5_init(&context);
while ((len = fread(buffer, 1, 1024, file)) > 0)
{
my_md5_update(&context, buffer, len);
while ((len = fread(buff, 1, sizeof(buff), file)) > 0) {
my_md5_update(&context, buff, len);
}
my_md5_final(digest, &context);
fclose(file);
}
return 0;
}