Blender  V2.93
wm_uilist_type.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
23 #include <stdio.h>
24 
25 #include "BLI_sys_types.h"
26 
28 
29 #include "MEM_guardedalloc.h"
30 
31 #include "BLI_ghash.h"
32 #include "BLI_utildefines.h"
33 
34 #include "BKE_screen.h"
35 
36 #include "WM_api.h"
37 #include "WM_types.h"
38 
40 
41 uiListType *WM_uilisttype_find(const char *idname, bool quiet)
42 {
43  if (idname[0]) {
45  if (ult) {
46  return ult;
47  }
48  }
49 
50  if (!quiet) {
51  printf("search for unknown uilisttype %s\n", idname);
52  }
53 
54  return NULL;
55 }
56 
58 {
60  return 1;
61 }
62 
64 {
65 
67 
68  BLI_assert(ok);
70 }
71 
72 /* called on initialize WM_init() */
74 {
75  uilisttypes_hash = BLI_ghash_str_new_ex("uilisttypes_hash gh", 16);
76 }
77 
79 {
80  GHashIterator gh_iter;
81  GHASH_ITER (gh_iter, uilisttypes_hash) {
82  uiListType *ult = BLI_ghashIterator_getValue(&gh_iter);
83  if (ult->rna_ext.free) {
84  ult->rna_ext.free(ult->rna_ext.data);
85  }
86  }
87 
90 }
#define BLI_assert(a)
Definition: BLI_assert.h:58
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.h:150
#define GHASH_ITER(gh_iter_, ghash_)
Definition: BLI_ghash.h:169
GHash * BLI_ghash_str_new_ex(const char *info, const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition: BLI_ghash.c:900
void BLI_ghash_insert(GHash *gh, void *key, void *val)
Definition: BLI_ghash.c:756
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition: BLI_ghash.c:1008
void * BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition: BLI_ghash.c:803
#define UNUSED_VARS_NDEBUG(...)
Read Guarded memory(de)allocation.
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void * data
Definition: RNA_types.h:680
StructFreeFunc free
Definition: RNA_types.h:683
char idname[BKE_ST_MAXNAME]
Definition: BKE_screen.h:338
ExtensionRNA rna_ext
Definition: BKE_screen.h:345
bool WM_uilisttype_add(uiListType *ult)
void WM_uilisttype_freelink(uiListType *ult)
uiListType * WM_uilisttype_find(const char *idname, bool quiet)
static GHash * uilisttypes_hash
void WM_uilisttype_free(void)
void WM_uilisttype_init(void)