Skip to content

Commit

Permalink
use static_assert() to validate that DDCA_Display_Event changes backw…
Browse files Browse the repository at this point in the history
…ard compatible
  • Loading branch information
rockowitz committed Jan 9, 2025
1 parent 09b413e commit 0dd1120
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/ddc/ddc_status_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright (C) 2024 Sanford Rockowitz <[email protected]>
// SPDX-License-Identifier: GPL-2.0-or-later

#include <assert.h>
#include <glib-2.0/glib.h>

#include "public/ddcutil_types.h"
Expand All @@ -24,6 +25,24 @@
// Trace class for this file
static DDCA_Trace_Group TRACE_GROUP = DDCA_TRC_NONE;


/** Use a static_assert() to ensure that the allocated size of
* DDCA_Display_Status_Event is unchanged from that in a prior
* release.
*/
void assert_ddca_display_status_event_size_unchanged() {
typedef struct {
uint64_t timestamp_nanos;
DDCA_Display_Event_Type event_type;
DDCA_IO_Path io_path;
char connector_name[32];
DDCA_Display_Ref dref;
void * unused[2];
} DDCA_Display_Status_Event_2_1_4;

static_assert(sizeof(DDCA_Display_Status_Event) == sizeof(DDCA_Display_Status_Event_2_1_4));
}

//
// Display Status Events
//
Expand Down

0 comments on commit 0dd1120

Please sign in to comment.