X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=types%2Fstring.c;h=0fdd81e33266b52b9b80a91c3dba72f41223edb0;hb=50cb52a8fd57684ccdc316f609f5d51f4dfcc2eb;hp=47e0970e890280b159d52d385a15cc0e60eed63b;hpb=98df1c9fb24d5e7e10bf628692011e130e0d8339;p=babeltrace.git diff --git a/types/string.c b/types/string.c index 47e0970e..0fdd81e3 100644 --- a/types/string.c +++ b/types/string.c @@ -3,7 +3,9 @@ * * BabelTrace - String Type Converter * - * Copyright 2010, 2011 - Mathieu Desnoyers + * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation + * + * Author: Mathieu Desnoyers * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -19,6 +21,7 @@ #include #include #include +#include static struct definition *_string_definition_new(struct declaration *declaration, @@ -77,6 +80,7 @@ struct definition * string->p.name = field_name; string->p.path = new_definition_path(parent_scope, field_name, root_name); + string->p.scope = NULL; string->value = NULL; string->len = 0; string->alloc_len = 0; @@ -96,3 +100,13 @@ void _string_definition_free(struct definition *definition) g_free(string->value); g_free(string); } + +char *get_string(struct definition *field) +{ + struct definition_string *string_definition = + container_of(field, struct definition_string, p); + + assert(string_definition->value != NULL); + + return string_definition->value; +}