Lines Matching +full:len +full:- +full:or +full:- +full:define
2 * P9Array - deep auto free C-array
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 #define QEMU_P9ARRAY_H
31 * P9Array provides a mechanism to access arrays in common C-style (e.g. by
52 * free(foo->s);
82 * P9ARRAY_DECLARE_TYPE() - Declares an array type for the passed @scalar_type.
88 #define P9ARRAY_DECLARE_TYPE(scalar_type) \
90 size_t len; \
94 void p9array_new_##scalar_type(scalar_type **auto_var, size_t len); \
98 * P9ARRAY_DEFINE_TYPE() - Defines an array type for the passed @scalar_type
107 #define P9ARRAY_DEFINE_TYPE(scalar_type, scalar_cleanup_func) \
108 void p9array_new_##scalar_type(scalar_type **auto_var, size_t len) \
112 len * sizeof(scalar_type)); \
113 arr->len = len; \
114 *auto_var = &arr->first[0]; \
124 ((char *)first) - offsetof(P9Array##scalar_type, first) \
126 for (size_t i = 0; i < arr->len; ++i) { \
127 scalar_cleanup_func(&arr->first[i]); \
133 * P9ARRAY_REF() - Declare a reference variable for an array.
141 #define P9ARRAY_REF(scalar_type) \
145 * P9ARRAY_NEW() - Allocate a new array.
149 * @len: amount of array elements to be allocated immediately
151 * Allocates a new array of passed @scalar_type with @len number of array
155 #define P9ARRAY_NEW(scalar_type, auto_var, len) \ argument
160 p9array_new_##scalar_type((&auto_var), len)