X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=types%2Farray.c;h=3a92ef769fff5684680b616c0391678226709ecc;hb=c462e188f3e7819c7bc74f671038cdbf36e8c3c0;hp=87b2083bcfdf4120ff41976ae6aa4689f887ac51;hpb=343c801f4e026a36093f654bdf88749d25f75fb4;p=babeltrace.git diff --git a/types/array.c b/types/array.c index 87b2083b..3a92ef76 100644 --- a/types/array.c +++ b/types/array.c @@ -16,10 +16,19 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include #include +#include #include static @@ -206,7 +215,18 @@ struct definition *array_index(struct definition_array *array, uint64_t i) return g_ptr_array_index(array->elems, i); } -GString *get_char_array(struct definition *field) +int get_array_len(const struct definition *field) +{ + struct definition_array *array_definition; + struct declaration_array *array_declaration; + + array_definition = container_of(field, struct definition_array, p); + array_declaration = array_definition->declaration; + + return array_declaration->len; +} + +GString *get_char_array(const struct definition *field) { struct definition_array *array_definition; struct declaration_array *array_declaration;