X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bindings%2Fpython%2Fpython-complements.c;h=3ef0a23af284171bef5bb12bab540cd18c0aad1b;hb=3043ee0c1760e16f7c3adc7526c4a5339d3d269d;hp=aa65555eaa8f4f1c440b2534b31cc377544bff50;hpb=ccde9b25397f3e74c60bfbcb9f77008299a44cc9;p=babeltrace.git diff --git a/bindings/python/python-complements.c b/bindings/python/python-complements.c index aa65555e..3ef0a23a 100644 --- a/bindings/python/python-complements.c +++ b/bindings/python/python-complements.c @@ -119,3 +119,32 @@ struct bt_ctf_field_decl *_bt_python_field_decl_one_from_list( { return list[index]; } + +struct definition_array *_bt_python_get_array_from_def( + struct bt_definition *field) +{ + const struct bt_declaration *array_decl; + struct definition_array *array = NULL; + + if (!field) { + goto end; + } + + array_decl = bt_ctf_get_decl_from_def(field); + if (bt_ctf_field_type(array_decl) == CTF_TYPE_ARRAY) { + array = container_of(field, struct definition_array, p); + } +end: + return array; +} + +struct definition_sequence *_bt_python_get_sequence_from_def( + struct bt_definition *field) +{ + if (field && bt_ctf_field_type( + bt_ctf_get_decl_from_def(field)) == CTF_TYPE_SEQUENCE) { + return container_of(field, struct definition_sequence, p); + } + + return NULL; +}