From 6b71274a81b38da08261f2122597c540b02b7aee Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 26 Feb 2011 16:01:55 -0500 Subject: [PATCH] CTF float/types compile fixes Signed-off-by: Mathieu Desnoyers --- formats/ctf/types/float.c | 16 ++++++++-------- include/babeltrace/ctf/types.h | 4 ++++ include/babeltrace/types.h | 14 +++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c index 3651f0c3..000bc183 100644 --- a/formats/ctf/types/float.c +++ b/formats/ctf/types/float.c @@ -111,7 +111,7 @@ double ctf_double_read(struct stream_pos *srcp, const struct type_class_float *float_class) { union doubleIEEE754 u; - struct type_class_float *dest_class = float_type_new(NULL, + struct type_class_float *dest_class = float_type_class_new(NULL, DBL_MANT_DIG, sizeof(double) * CHAR_BIT - DBL_MANT_DIG, BYTE_ORDER, @@ -121,7 +121,7 @@ double ctf_double_read(struct stream_pos *srcp, align_pos(srcp, float_class->p.alignment); init_pos(&destp, (char *) u.bits); _ctf_float_copy(&destp, dest_class, srcp, float_class); - float_type_free(dest_class); + type_class_unref(&dest_class->p); return u.v; } @@ -130,7 +130,7 @@ void ctf_double_write(struct stream_pos *destp, double v) { union doubleIEEE754 u; - struct type_class_float *src_class = float_type_new(NULL, + struct type_class_float *src_class = float_type_class_new(NULL, DBL_MANT_DIG, sizeof(double) * CHAR_BIT - DBL_MANT_DIG, BYTE_ORDER, @@ -141,14 +141,14 @@ void ctf_double_write(struct stream_pos *destp, align_pos(destp, float_class->p.alignment); init_pos(&srcp, (char *) u.bits); _ctf_float_copy(destp, float_class, &srcp, src_class); - float_type_free(src_class); + type_class_unref(&src_class->p); } long double ctf_ldouble_read(struct stream_pos *srcp, const struct type_class_float *float_class) { union ldoubleIEEE754 u; - struct type_class_float *dest_class = float_type_new(NULL, + struct type_class_float *dest_class = float_type_class_new(NULL, LDBL_MANT_DIG, sizeof(long double) * CHAR_BIT - LDBL_MANT_DIG, BYTE_ORDER, @@ -158,7 +158,7 @@ long double ctf_ldouble_read(struct stream_pos *srcp, align_pos(srcp, float_class->p.alignment); init_pos(&destp, (char *) u.bits); _ctf_float_copy(&destp, dest_class, srcp, float_class); - float_type_free(dest_class); + type_class_unref(&dest_class->p); return u.v; } @@ -167,7 +167,7 @@ void ctf_ldouble_write(struct stream_pos *destp, long double v) { union ldoubleIEEE754 u; - struct type_class_float *src_class = float_type_new(NULL, + struct type_class_float *src_class = float_type_class_new(NULL, LDBL_MANT_DIG, sizeof(long double) * CHAR_BIT - LDBL_MANT_DIG, BYTE_ORDER, @@ -178,5 +178,5 @@ void ctf_ldouble_write(struct stream_pos *destp, align_pos(destp, float_class->p.alignment); init_pos(&srcp, (char *) u.bits); _ctf_float_copy(destp, float_class, &srcp, src_class); - float_type_free(src_class); + type_class_unref(&src_class->p); } diff --git a/include/babeltrace/ctf/types.h b/include/babeltrace/ctf/types.h index c5ce9d2b..6db8d270 100644 --- a/include/babeltrace/ctf/types.h +++ b/include/babeltrace/ctf/types.h @@ -74,6 +74,10 @@ void ctf_struct_begin(struct stream_pos *pos, const struct type_class_struct *struct_class); void ctf_struct_end(struct stream_pos *pos, const struct type_class_struct *struct_class); +void ctf_variant_begin(struct stream_pos *pos, + const struct type_class_variant *variant_class); +void ctf_variant_end(struct stream_pos *pos, + const struct type_class_variant *variant_class); void ctf_array_begin(struct stream_pos *pos, const struct type_class_array *array_class); void ctf_array_end(struct stream_pos *pos, diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h index 242b9057..da2387d3 100644 --- a/include/babeltrace/types.h +++ b/include/babeltrace/types.h @@ -87,6 +87,13 @@ char *get_pos_addr(struct stream_pos *pos) struct format; struct type; +/* Type declaration scope */ +struct declaration_scope { + /* Hash table mapping type name GQuark to struct type_class */ + GHashTable *type_classes; + struct declaration_scope *parent_scope; +}; + struct type_class { GQuark name; /* type name */ size_t alignment; /* type alignment, in bits */ @@ -277,13 +284,6 @@ struct type_sequence { struct field current_element; /* struct field */ }; -/* Type declaration scope */ -struct declaration_scope { - /* Hash table mapping type name GQuark to struct type_class */ - GHashTable *type_classes; - struct declaration_scope *parent_scope; -}; - struct type_class *lookup_type_class(GQuark qname, struct declaration_scope *scope); int register_type_class(struct type_class *type_class, -- 2.34.1