Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jdesfossez@efficios.com (Julien Desfossez)
Subject: [lttng-dev] [BABELTRACE PATCH 08/18] namespace the enum functions
Date: Thu, 24 Jan 2013 16:21:40 -0500	[thread overview]
Message-ID: <1359062510-7557-8-git-send-email-jdesfossez@efficios.com> (raw)
In-Reply-To: <1359062510-7557-1-git-send-email-jdesfossez@efficios.com>

Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 formats/ctf/events.c                               |    4 +--
 .../ctf/metadata/ctf-visitor-generate-io-struct.c  |    6 ++--
 formats/ctf/types/enum.c                           |    4 +--
 include/babeltrace/types.h                         |   14 ++++-----
 types/enum.c                                       |   30 ++++++++++----------
 types/variant.c                                    |    4 +--
 6 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index b530cd5..1d1ef6f 100644
--- a/formats/ctf/events.c
+++ b/formats/ctf/events.c
@@ -463,10 +463,10 @@ const char *bt_ctf_get_enum_str(const struct definition *field)
 	def_enum = container_of(field, const struct definition_enum, p);
 	decl_enum = def_enum->declaration;
 	if (get_int_signedness(&def_enum->integer->p)) {
-		array = enum_int_to_quark_set(decl_enum,
+		array = bt_enum_int_to_quark_set(decl_enum,
 			get_signed_int(&def_enum->integer->p));
 	} else {
-		array = enum_uint_to_quark_set(decl_enum,
+		array = bt_enum_uint_to_quark_set(decl_enum,
 			get_unsigned_int(&def_enum->integer->p));
 	}
 	if (!array) {
diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 9ade8c4..928262f 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -1007,7 +1007,7 @@ int ctf_enumerator_list_visit(FILE *fd, int depth,
 		if (nr_vals <= 1)
 			end = start;
 		last->u.s = end + 1;
-		enum_signed_insert(enum_declaration, start, end, q);
+		bt_enum_signed_insert(enum_declaration, start, end, q);
 	} else {
 		uint64_t start, end;
 		int nr_vals = 0;
@@ -1047,7 +1047,7 @@ int ctf_enumerator_list_visit(FILE *fd, int depth,
 		if (nr_vals <= 1)
 			end = start;
 		last->u.u = end + 1;
-		enum_unsigned_insert(enum_declaration, start, end, q);
+		bt_enum_unsigned_insert(enum_declaration, start, end, q);
 	}
 	return 0;
 }
@@ -1114,7 +1114,7 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth,
 			return NULL;
 		}
 		integer_declaration = container_of(declaration, struct declaration_integer, p);
-		enum_declaration = enum_declaration_new(integer_declaration);
+		enum_declaration = bt_enum_declaration_new(integer_declaration);
 		bt_declaration_unref(&integer_declaration->p);	/* leave ref to enum */
 		if (enum_declaration->integer_declaration->signedness) {
 			last_value.u.s = 0;
diff --git a/formats/ctf/types/enum.c b/formats/ctf/types/enum.c
index e4e7ac8..1891175 100644
--- a/formats/ctf/types/enum.c
+++ b/formats/ctf/types/enum.c
@@ -48,14 +48,14 @@ int ctf_enum_read(struct stream_pos *ppos, struct definition *definition)
 	if (ret)
 		return ret;
 	if (!integer_declaration->signedness) {
-		qs = enum_uint_to_quark_set(enum_declaration,
+		qs = bt_enum_uint_to_quark_set(enum_declaration,
 			integer_definition->value._unsigned);
 		if (!qs) {
 			fprintf(stderr, "[warning] Unknown value %" PRIu64 " in enum.\n",
 				integer_definition->value._unsigned);
 		}
 	} else {
-		qs = enum_int_to_quark_set(enum_declaration,
+		qs = bt_enum_int_to_quark_set(enum_declaration,
 			integer_definition->value._signed);
 		if (!qs) {
 			fprintf(stderr, "[warning] Unknown value %" PRId64 " in enum.\n",
diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h
index 1b0cd2b..15bbef3 100644
--- a/include/babeltrace/types.h
+++ b/include/babeltrace/types.h
@@ -399,14 +399,14 @@ struct declaration_float *float_declaration_new(size_t mantissa_len,
  * Returns a GArray of GQuark or NULL.
  * Caller must release the GArray with g_array_unref().
  */
-GArray *enum_uint_to_quark_set(const struct declaration_enum *enum_declaration,
+GArray *bt_enum_uint_to_quark_set(const struct declaration_enum *enum_declaration,
 			       uint64_t v);
 
 /*
  * Returns a GArray of GQuark or NULL.
  * Caller must release the GArray with g_array_unref().
  */
-GArray *enum_int_to_quark_set(const struct declaration_enum *enum_declaration,
+GArray *bt_enum_int_to_quark_set(const struct declaration_enum *enum_declaration,
 			      int64_t v);
 
 /*
@@ -414,16 +414,16 @@ GArray *enum_int_to_quark_set(const struct declaration_enum *enum_declaration,
  * Callers do _not_ own the returned GArray (and therefore _don't_ need to
  * release it).
  */
-GArray *enum_quark_to_range_set(const struct declaration_enum *enum_declaration,
+GArray *bt_enum_quark_to_range_set(const struct declaration_enum *enum_declaration,
 				GQuark q);
-void enum_signed_insert(struct declaration_enum *enum_declaration,
+void bt_enum_signed_insert(struct declaration_enum *enum_declaration,
                         int64_t start, int64_t end, GQuark q);
-void enum_unsigned_insert(struct declaration_enum *enum_declaration,
+void bt_enum_unsigned_insert(struct declaration_enum *enum_declaration,
 			  uint64_t start, uint64_t end, GQuark q);
-size_t enum_get_nr_enumerators(struct declaration_enum *enum_declaration);
+size_t bt_enum_get_nr_enumerators(struct declaration_enum *enum_declaration);
 
 struct declaration_enum *
-	enum_declaration_new(struct declaration_integer *integer_declaration);
+	bt_enum_declaration_new(struct declaration_integer *integer_declaration);
 
 struct declaration_string *
 	string_declaration_new(enum ctf_string_encoding encoding);
diff --git a/types/enum.c b/types/enum.c
index 43df4eb..6d33713 100644
--- a/types/enum.c
+++ b/types/enum.c
@@ -124,7 +124,7 @@ void enum_val_free(void *ptr)
  * Returns a GArray or NULL.
  * Caller must release the GArray with g_array_unref().
  */
-GArray *enum_uint_to_quark_set(const struct declaration_enum *enum_declaration,
+GArray *bt_enum_uint_to_quark_set(const struct declaration_enum *enum_declaration,
 			       uint64_t v)
 {
 	struct enum_range_to_quark *iter;
@@ -171,7 +171,7 @@ GArray *enum_uint_to_quark_set(const struct declaration_enum *enum_declaration,
  * Returns a GArray or NULL.
  * Caller must release the GArray with g_array_unref().
  */
-GArray *enum_int_to_quark_set(const struct declaration_enum *enum_declaration,
+GArray *bt_enum_int_to_quark_set(const struct declaration_enum *enum_declaration,
 			      int64_t v)
 {
 	struct enum_range_to_quark *iter;
@@ -215,7 +215,7 @@ GArray *enum_int_to_quark_set(const struct declaration_enum *enum_declaration,
 }
 
 static
-void enum_unsigned_insert_value_to_quark_set(struct declaration_enum *enum_declaration,
+void bt_enum_unsigned_insert_value_to_quark_set(struct declaration_enum *enum_declaration,
 			 uint64_t v, GQuark q)
 {
 	uint64_t *valuep;
@@ -241,7 +241,7 @@ void enum_unsigned_insert_value_to_quark_set(struct declaration_enum *enum_decla
 }
 
 static
-void enum_signed_insert_value_to_quark_set(struct declaration_enum *enum_declaration,
+void bt_enum_signed_insert_value_to_quark_set(struct declaration_enum *enum_declaration,
 			int64_t v, GQuark q)
 {
 	int64_t *valuep;
@@ -266,7 +266,7 @@ void enum_signed_insert_value_to_quark_set(struct declaration_enum *enum_declara
 	}
 }
 
-GArray *enum_quark_to_range_set(const struct declaration_enum *enum_declaration,
+GArray *bt_enum_quark_to_range_set(const struct declaration_enum *enum_declaration,
 				GQuark q)
 {
 	return g_hash_table_lookup(enum_declaration->table.quark_to_range_set,
@@ -274,7 +274,7 @@ GArray *enum_quark_to_range_set(const struct declaration_enum *enum_declaration,
 }
 
 static
-void enum_signed_insert_range_to_quark(struct declaration_enum *enum_declaration,
+void bt_enum_signed_insert_range_to_quark(struct declaration_enum *enum_declaration,
                         int64_t start, int64_t end, GQuark q)
 {
 	struct enum_range_to_quark *rtoq;
@@ -287,7 +287,7 @@ void enum_signed_insert_range_to_quark(struct declaration_enum *enum_declaration
 }
 
 static
-void enum_unsigned_insert_range_to_quark(struct declaration_enum *enum_declaration,
+void bt_enum_unsigned_insert_range_to_quark(struct declaration_enum *enum_declaration,
                         uint64_t start, uint64_t end, GQuark q)
 {
 	struct enum_range_to_quark *rtoq;
@@ -299,14 +299,14 @@ void enum_unsigned_insert_range_to_quark(struct declaration_enum *enum_declarati
 	rtoq->quark = q;
 }
 
-void enum_signed_insert(struct declaration_enum *enum_declaration,
+void bt_enum_signed_insert(struct declaration_enum *enum_declaration,
                         int64_t start, int64_t end, GQuark q)
 {
 	GArray *array;
 	struct enum_range *range;
 
 	if (start == end) {
-		enum_signed_insert_value_to_quark_set(enum_declaration, start, q);
+		bt_enum_signed_insert_value_to_quark_set(enum_declaration, start, q);
 	} else {
 		if (start > end) {
 			uint64_t tmp;
@@ -315,7 +315,7 @@ void enum_signed_insert(struct declaration_enum *enum_declaration,
 			start = end;
 			end = tmp;
 		}
-		enum_signed_insert_range_to_quark(enum_declaration, start, end, q);
+		bt_enum_signed_insert_range_to_quark(enum_declaration, start, end, q);
 	}
 
 	array = g_hash_table_lookup(enum_declaration->table.quark_to_range_set,
@@ -333,7 +333,7 @@ void enum_signed_insert(struct declaration_enum *enum_declaration,
 	range->end._signed = end;
 }
 
-void enum_unsigned_insert(struct declaration_enum *enum_declaration,
+void bt_enum_unsigned_insert(struct declaration_enum *enum_declaration,
 			  uint64_t start, uint64_t end, GQuark q)
 {
 	GArray *array;
@@ -341,7 +341,7 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration,
 
 
 	if (start == end) {
-		enum_unsigned_insert_value_to_quark_set(enum_declaration, start, q);
+		bt_enum_unsigned_insert_value_to_quark_set(enum_declaration, start, q);
 	} else {
 		if (start > end) {
 			uint64_t tmp;
@@ -350,7 +350,7 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration,
 			start = end;
 			end = tmp;
 		}
-		enum_unsigned_insert_range_to_quark(enum_declaration, start, end, q);
+		bt_enum_unsigned_insert_range_to_quark(enum_declaration, start, end, q);
 	}
 
 	array = g_hash_table_lookup(enum_declaration->table.quark_to_range_set,
@@ -368,7 +368,7 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration,
 	range->end._unsigned = end;
 }
 
-size_t enum_get_nr_enumerators(struct declaration_enum *enum_declaration)
+size_t bt_enum_get_nr_enumerators(struct declaration_enum *enum_declaration)
 {
 	return g_hash_table_size(enum_declaration->table.quark_to_range_set);
 }
@@ -391,7 +391,7 @@ void _enum_declaration_free(struct declaration *declaration)
 }
 
 struct declaration_enum *
-	enum_declaration_new(struct declaration_integer *integer_declaration)
+	bt_enum_declaration_new(struct declaration_integer *integer_declaration)
 {
 	struct declaration_enum *enum_declaration;
 
diff --git a/types/variant.c b/types/variant.c
index a58c17f..47c821e 100644
--- a/types/variant.c
+++ b/types/variant.c
@@ -144,14 +144,14 @@ int check_enum_tag(struct definition_variant *variant,
 	 * variant choice map to an enumerator too. We then validate that the
 	 * number of enumerators equals the number of variant choices.
 	 */
-	if (variant->declaration->untagged_variant->fields->len != enum_get_nr_enumerators(enum_declaration))
+	if (variant->declaration->untagged_variant->fields->len != bt_enum_get_nr_enumerators(enum_declaration))
 		return -EPERM;
 
 	for (i = 0; i < variant->declaration->untagged_variant->fields->len; i++) {
 		struct declaration_field *field_declaration =
 			&g_array_index(variant->declaration->untagged_variant->fields,
 				       struct declaration_field, i);
-		if (!enum_quark_to_range_set(enum_declaration, field_declaration->name)) {
+		if (!bt_enum_quark_to_range_set(enum_declaration, field_declaration->name)) {
 			missing_field = 1;
 			break;
 		}
-- 
1.7.10.4




  parent reply	other threads:[~2013-01-24 21:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 21:21 [lttng-dev] [BABELTRACE PATCH 01/18] BT_HIDDEN macro Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 02/18] Hide internal functions of ctf-text Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 03/18] Hide internal functions of libbabeltrace-ctf Julien Desfossez
2013-01-24 21:26   ` Julien Desfossez
2013-01-24 22:08   ` Julien Desfossez
2013-01-24 22:27     ` Mathieu Desnoyers
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 04/18] namespace the scope_path functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 05/18] namespace the array functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 06/18] namespace declaration_ref and declaration_unref Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 07/18] namespace definition_ref and definition_unref Julien Desfossez
2013-01-24 21:21 ` Julien Desfossez [this message]
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 09/18] namespace the int functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 10/18] namespace the sequence functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 11/18] namespace the string functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 12/18] namespace the struct functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 13/18] namespace the heap functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 14/18] namespace the collection functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 15/18] namespace the declaration functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 16/18] namespace the variant functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 17/18] namespace the definition functions Julien Desfossez
2013-01-24 21:21 ` [lttng-dev] [BABELTRACE PATCH 18/18] namespace the lookup_integer function Julien Desfossez

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=1359062510-7557-8-git-send-email-jdesfossez@efficios.com \
    --to=jdesfossez@efficios.com \
    /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