Cleanup: use static assert to disable access to preferences

Prefer this over an unknown identifier as it gives a useful error.
This commit is contained in:
Campbell Barton
2020-09-17 15:23:23 +10:00
parent 8dd5902e1e
commit 8e0fc27722
2 changed files with 4 additions and 4 deletions

View File

@@ -260,8 +260,8 @@ static void userdef_free_addons(UserDef *userdef)
*/
void BKE_blender_userdef_data_free(UserDef *userdef, bool clear_fonts)
{
#define U _invalid_access_ /* ensure no accidental global access */
#ifdef U /* quiet warning */
#define U BLI_STATIC_ASSERT(false, "Global 'U' not allowed, only use arguments passed in!")
#ifdef U /* quiet warning */
#endif
userdef_free_keymaps(userdef);

View File

@@ -48,8 +48,8 @@
#include "wm_event_types.h"
/* Disallow access to global userdef. */
#define U (_error_)
/* For versioning we only ever want to manipulate preferences passed in. */
#define U BLI_STATIC_ASSERT(false, "Global 'U' not allowed, only use arguments passed in!")
static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
{