Add missing permission notice in each source file
[babeltrace.git] / types / float.c
index cc6c957aeebe09ebc6124cc4cdf8db985f558893..028749bc92a177f91237283797a234a65fd21284 100644 (file)
  *
  * 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 <babeltrace/compiler.h>
 #include <babeltrace/format.h>
-#include <endian.h>
+#include <babeltrace/types.h>
+#include <babeltrace/endian.h>
 
 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;
 }
 
This page took 0.023455 seconds and 4 git commands to generate.