Page MenuHome

RNA: Cleanup PointerRNA struct
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Thu, Aug 22, 5:35 PM.

Details

Summary

The old layout of the PointerRNA was confusing for historic reasons:

typedef struct PointerRNA {
  struct {
    void *data;
  } id;

  struct StructRNA *type;
  void *data;
} PointerRNA;

This patch updates it to:

typedef struct PointerRNA {
  struct ID *owner_id;
  struct StructRNA *type;
  void *data;
} PointerRNA;

Replacing id.data was easy.
Correcting all the type casts took a bit more time.
I added many casts that were implicit beforehand, because
otherwise they would trigger warnings now. Some casts to ID *
were removed as well.

Hope I found all the missing casts, but some are missing probably.
At least I can build an entire debug build without any warnings.

Diff Detail

Repository
rB Blender

Event Timeline

source/blender/editors/space_action/space_action.c
376

I guess these changes from D5556: Cleanup: unify zero initialization of structs were accidentally included.

  • replace some {0} with {{0}} again

Previously they were {{{0}}}, but one level had to be removed.

This revision is now accepted and ready to land.Thu, Aug 22, 5:57 PM
  • remove more unnecessary casts to ID*
  • replace (ptr->owner_id)->name with ptr->owner_id->name

Will commit tomorrow, so that I can fix issues quickly when they come up.

Tested with clang's -Weverything, doesn't introduce new warnings.

This revision was automatically updated to reflect the committed changes.