Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] [BABELTRACE PATCH] Handler function to extract string from fields
@ 2011-11-23 18:19 Julien Desfossez
  2011-11-28 14:26 ` [lttng-dev] " Mathieu Desnoyers
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Desfossez @ 2011-11-23 18:19 UTC (permalink / raw)


Following the same principle as get_char_array and get_(un)signed_int,
this function returns a char* to a string from an event field.

Signed-off-by: Julien Desfossez <julien.desfossez at polymtl.ca>
---
 types/string.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/types/string.c b/types/string.c
index 9eaa9df..bff569d 100644
--- a/types/string.c
+++ b/types/string.c
@@ -99,3 +99,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;
+}
-- 
1.7.7.1





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-28 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-23 18:19 [ltt-dev] [BABELTRACE PATCH] Handler function to extract string from fields Julien Desfossez
2011-11-28 14:26 ` [lttng-dev] " Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox