Skip to content

Commit

Permalink
allow multiple aws_sdkutils_library_init() calls (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm authored Feb 7, 2022
1 parent 21772f3 commit e3c23f4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/sdkutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,24 @@ static struct aws_log_subject_info_list s_sdkutils_log_subjects = {
.count = AWS_ARRAY_SIZE(s_log_subject_infos),
};

static int s_library_init_count = 0;

void aws_sdkutils_library_init(struct aws_allocator *allocator) {
if (s_library_init_count++ != 0) {
return;
}

aws_common_library_init(allocator);

aws_register_error_info(&s_sdkutils_error_info);
aws_register_log_subject_info_list(&s_sdkutils_log_subjects);
}

void aws_sdkutils_library_clean_up(void) {
if (--s_library_init_count != 0) {
return;
}

aws_unregister_log_subject_info_list(&s_sdkutils_log_subjects);
aws_unregister_error_info(&s_sdkutils_error_info);

Expand Down

0 comments on commit e3c23f4

Please sign in to comment.