*
* BabelTrace - String Type Converter
*
- * Copyright 2010, 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
+ *
+ * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
#include <babeltrace/compiler.h>
#include <babeltrace/align.h>
#include <babeltrace/format.h>
+#include <babeltrace/types.h>
static
struct definition *_string_definition_new(struct declaration *declaration,
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;
g_free(string->value);
g_free(string);
}
+
+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);
+
+ assert(string_definition->value != NULL);
+
+ return string_definition->value;
+}