X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Fstring.c;h=4860740616ae97631c1a0c61ffd6f61a10ef8220;hp=bff569db93bb11118b0904d48fcc5f1454623863;hb=c462e188f3e7819c7bc74f671038cdbf36e8c3c0;hpb=98b6832656447ab0f8024f9086aa67625e391ac7 diff --git a/types/string.c b/types/string.c index bff569db..48607406 100644 --- a/types/string.c +++ b/types/string.c @@ -16,11 +16,20 @@ * * 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 struct definition *_string_definition_new(struct declaration *declaration, @@ -100,7 +109,18 @@ void _string_definition_free(struct definition *definition) g_free(string); } -char *get_string(struct definition *field) +enum ctf_string_encoding get_string_encoding(const struct definition *field) +{ + struct definition_string *string_definition; + const struct declaration_string *string_declaration; + + string_definition = container_of(field, struct definition_string, p); + string_declaration = string_definition->declaration; + + return string_declaration->encoding; +} + +char *get_string(const struct definition *field) { struct definition_string *string_definition = container_of(field, struct definition_string, p);