X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Ffloat.c;h=028749bc92a177f91237283797a234a65fd21284;hp=cc6c957aeebe09ebc6124cc4cdf8db985f558893;hb=c462e188f3e7819c7bc74f671038cdbf36e8c3c0;hpb=01c76b246be85b5d9c8e99813950fb194c9f714f diff --git a/types/float.c b/types/float.c index cc6c957a..028749bc 100644 --- a/types/float.c +++ b/types/float.c @@ -16,11 +16,20 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include #include -#include +#include +#include static struct definition *_float_definition_new(struct declaration *declaration, @@ -61,13 +70,13 @@ struct declaration_float * float_declaration->sign = integer_declaration_new(1, byte_order, false, 1, 2, - CTF_STRING_NONE); + CTF_STRING_NONE, NULL); float_declaration->mantissa = integer_declaration_new(mantissa_len - 1, byte_order, false, 1, 10, - CTF_STRING_NONE); + CTF_STRING_NONE, NULL); float_declaration->exp = integer_declaration_new(exp_len, byte_order, true, 1, 10, - CTF_STRING_NONE); + CTF_STRING_NONE, NULL); return float_declaration; } @@ -82,7 +91,6 @@ struct definition * container_of(declaration, struct declaration_float, p); struct definition_float *_float; struct definition *tmp; - int ret; _float = g_new(struct definition_float, 1); declaration_ref(&float_declaration->p); @@ -119,9 +127,13 @@ struct definition * _float->p.index = root_name ? INT_MAX : index; _float->p.name = field_name; _float->value = 0.0; - ret = register_field_definition(field_name, &_float->p, - parent_scope); - assert(!ret); + if (parent_scope) { + int ret; + + ret = register_field_definition(field_name, &_float->p, + parent_scope); + assert(!ret); + } return &_float->p; }