~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/blenlib/BLI_mempool.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
/** \file BLI_mempool.h
32
32
 *  \ingroup bli
33
33
 *  \author Geoffrey Bantle
34
 
 *  \brief Simple fast memory allocator.
 
34
 *  \brief Simple fast memory allocator for fixed size chunks.
35
35
 */
36
36
 
37
37
#ifdef __cplusplus
48
48
 * first four bytes of the elements never contain the character string
49
49
 * 'free'.  use with care.*/
50
50
 
51
 
BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag);
52
 
void *BLI_mempool_alloc(BLI_mempool *pool);
53
 
void *BLI_mempool_calloc(BLI_mempool *pool);
54
 
void  BLI_mempool_free(BLI_mempool *pool, void *addr);
55
 
void  BLI_mempool_destroy(BLI_mempool *pool);
56
 
int   BLI_mempool_count(BLI_mempool *pool);
57
 
void *BLI_mempool_findelem(BLI_mempool *pool, int index);
 
51
BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
 
52
#ifdef __GNUC__
 
53
__attribute__((warn_unused_result))
 
54
#endif
 
55
;
 
56
void        *BLI_mempool_alloc(BLI_mempool *pool)
 
57
#ifdef __GNUC__
 
58
__attribute__((warn_unused_result))
 
59
__attribute__((nonnull(1)))
 
60
#endif
 
61
;
 
62
void        *BLI_mempool_calloc(BLI_mempool *pool)
 
63
#ifdef __GNUC__
 
64
__attribute__((warn_unused_result))
 
65
__attribute__((nonnull(1)))
 
66
#endif
 
67
;
 
68
void         BLI_mempool_free(BLI_mempool *pool, void *addr)
 
69
#ifdef __GNUC__
 
70
__attribute__((nonnull(1, 2)))
 
71
#endif
 
72
;
 
73
void         BLI_mempool_destroy(BLI_mempool *pool)
 
74
#ifdef __GNUC__
 
75
__attribute__((nonnull(1)))
 
76
#endif
 
77
;
 
78
int          BLI_mempool_count(BLI_mempool *pool)
 
79
#ifdef __GNUC__
 
80
__attribute__((nonnull(1)))
 
81
#endif
 
82
;
 
83
void        *BLI_mempool_findelem(BLI_mempool *pool, int index)
 
84
#ifdef __GNUC__
 
85
__attribute__((warn_unused_result))
 
86
__attribute__((nonnull(1)))
 
87
#endif
 
88
;
 
89
void        BLI_mempool_as_array(BLI_mempool *pool, void **data)
 
90
#ifdef __GNUC__
 
91
__attribute__((nonnull(1)))
 
92
#endif
 
93
;
 
94
 
 
95
void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr)
 
96
#ifdef __GNUC__
 
97
__attribute__((warn_unused_result))
 
98
__attribute__((nonnull(1, 2)))
 
99
#endif
 
100
;
58
101
 
59
102
/** iteration stuff.  note: this may easy to produce bugs with **/
60
 
/*private structure*/
 
103
/* private structure */
61
104
typedef struct BLI_mempool_iter {
62
105
        BLI_mempool *pool;
63
106
        struct BLI_mempool_chunk *curchunk;
70
113
        BLI_MEMPOOL_ALLOW_ITER = (1 << 1)
71
114
};
72
115
 
73
 
void  BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter);
74
 
void *BLI_mempool_iterstep(BLI_mempool_iter *iter);
 
116
void  BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
 
117
#ifdef __GNUC__
 
118
__attribute__((nonnull(1, 2)))
 
119
#endif
 
120
;
 
121
void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
 
122
#ifdef __GNUC__
 
123
__attribute__((warn_unused_result))
 
124
__attribute__((nonnull(1)))
 
125
#endif
 
126
;
75
127
 
76
128
#ifdef __cplusplus
77
129
}
78
130
#endif
79
131
 
80
 
#endif
 
132
#endif  /* __BLI_MEMPOOL_H__ */