| 2727 | } |
| 2728 | |
| 2729 | unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str) |
| 2730 | { |
| 2731 | char** new_keys = (char**)(lodepng_realloc(info->text_keys, sizeof(char*) * (info->text_num + 1))); |
| 2732 | char** new_strings = (char**)(lodepng_realloc(info->text_strings, sizeof(char*) * (info->text_num + 1))); |
| 2733 | if(!new_keys || !new_strings) |
| 2734 | { |
| 2735 | lodepng_free(new_keys); |
| 2736 | lodepng_free(new_strings); |
| 2737 | return 83; /*alloc fail*/ |
| 2738 | } |
| 2739 | |
| 2740 | info->text_num++; |
| 2741 | info->text_keys = new_keys; |
| 2742 | info->text_strings = new_strings; |
| 2743 | |
| 2744 | string_init(&info->text_keys[info->text_num - 1]); |
| 2745 | string_set(&info->text_keys[info->text_num - 1], key); |
| 2746 | |
| 2747 | string_init(&info->text_strings[info->text_num - 1]); |
| 2748 | string_set(&info->text_strings[info->text_num - 1], str); |
| 2749 | |
| 2750 | return 0; |
| 2751 | } |
| 2752 | |
| 2753 | /******************************************************************************/ |
| 2754 |
no test coverage detected