edid: make di_edid_destroy() public

We'll allow users to create their own EDIDs, so they'll need to
cleanup.

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2023-04-14 12:03:45 +02:00
parent 598bde5846
commit 301ea46f29
4 changed files with 12 additions and 12 deletions

8
edid.c
View file

@ -1256,7 +1256,7 @@ _di_edid_parse(const void *data, size_t size, FILE *failure_msg_file)
+ 0x26 + i * EDID_STANDARD_TIMING_SIZE; + 0x26 + i * EDID_STANDARD_TIMING_SIZE;
if (!parse_standard_timing(edid, standard_timing_data, if (!parse_standard_timing(edid, standard_timing_data,
&standard_timing)) { &standard_timing)) {
_di_edid_destroy(edid); di_edid_destroy(edid);
return NULL; return NULL;
} }
if (standard_timing) { if (standard_timing) {
@ -1269,7 +1269,7 @@ _di_edid_parse(const void *data, size_t size, FILE *failure_msg_file)
byte_desc_data = (const uint8_t *) data byte_desc_data = (const uint8_t *) data
+ 0x36 + i * EDID_BYTE_DESCRIPTOR_SIZE; + 0x36 + i * EDID_BYTE_DESCRIPTOR_SIZE;
if (!parse_byte_descriptor(edid, byte_desc_data)) { if (!parse_byte_descriptor(edid, byte_desc_data)) {
_di_edid_destroy(edid); di_edid_destroy(edid);
return NULL; return NULL;
} }
} }
@ -1277,7 +1277,7 @@ _di_edid_parse(const void *data, size_t size, FILE *failure_msg_file)
for (i = 0; i < exts_len; i++) { for (i = 0; i < exts_len; i++) {
ext_data = (const uint8_t *) data + (i + 1) * EDID_BLOCK_SIZE; ext_data = (const uint8_t *) data + (i + 1) * EDID_BLOCK_SIZE;
if (!parse_ext(edid, ext_data)) { if (!parse_ext(edid, ext_data)) {
_di_edid_destroy(edid); di_edid_destroy(edid);
return NULL; return NULL;
} }
} }
@ -1314,7 +1314,7 @@ destroy_display_descriptor(struct di_edid_display_descriptor *desc)
} }
void void
_di_edid_destroy(struct di_edid *edid) di_edid_destroy(struct di_edid *edid)
{ {
size_t i; size_t i;
struct di_edid_ext *ext; struct di_edid_ext *ext;

View file

@ -143,12 +143,6 @@ struct di_edid_ext {
struct di_edid * struct di_edid *
_di_edid_parse(const void *data, size_t size, FILE *failure_msg_file); _di_edid_parse(const void *data, size_t size, FILE *failure_msg_file);
/**
* Destroy an EDID data structure.
*/
void
_di_edid_destroy(struct di_edid *edid);
/** /**
* Parse an EDID detailed timing definition. * Parse an EDID detailed timing definition.
*/ */

View file

@ -18,6 +18,12 @@
*/ */
struct di_edid; struct di_edid;
/**
* Destroy an EDID.
*/
void
di_edid_destroy(struct di_edid *edid);
/** /**
* Get the EDID version. * Get the EDID version.
*/ */

4
info.c
View file

@ -43,7 +43,7 @@ di_info_parse_edid(const void *data, size_t size)
return info; return info;
err_edid: err_edid:
_di_edid_destroy(edid); di_edid_destroy(edid);
err_failure_msg_file: err_failure_msg_file:
memory_stream_cleanup(&failure_msg); memory_stream_cleanup(&failure_msg);
return NULL; return NULL;
@ -52,7 +52,7 @@ err_failure_msg_file:
void void
di_info_destroy(struct di_info *info) di_info_destroy(struct di_info *info)
{ {
_di_edid_destroy(info->edid); di_edid_destroy(info->edid);
free(info->failure_msg); free(info->failure_msg);
free(info); free(info);
} }