Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: julien.desfossez@polymtl.ca (Julien Desfossez)
Subject: [ltt-dev] [BABELTRACE PATCH] Handler function to extract string from fields
Date: Wed, 23 Nov 2011 13:19:03 -0500	[thread overview]
Message-ID: <1322072343-18749-1-git-send-email-julien.desfossez@polymtl.ca> (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





             reply	other threads:[~2011-11-23 18:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23 18:19 Julien Desfossez [this message]
2011-11-28 14:26 ` [lttng-dev] " Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322072343-18749-1-git-send-email-julien.desfossez@polymtl.ca \
    --to=julien.desfossez@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox