PebbleOS
Loading...
Searching...
No Matches
Macros
Structure access

Structure access helpers. More...

Macros

#define NULL_SAFE_FIELD_ACCESS(struct_ptr, field_name, default_value)    ((struct_ptr) ? ((struct_ptr)->field_name) : (default_value))
 Read a structure field through a pointer that may be NULL.
 

Detailed Description

Structure access helpers.

Macro Definition Documentation

◆ NULL_SAFE_FIELD_ACCESS

#define NULL_SAFE_FIELD_ACCESS (   struct_ptr,
  field_name,
  default_value 
)     ((struct_ptr) ? ((struct_ptr)->field_name) : (default_value))

Read a structure field through a pointer that may be NULL.

Parameters
struct_ptrPointer to the structure, evaluated twice.
field_nameField to read.
default_valueValue when struct_ptr is NULL.
Returns
struct_ptr->field_name, or default_value.