Move to kernel style SPDX license identifiers
[babeltrace.git] / src / compat / stdio.h
index 906e695dfd9227a438195fec0ab8c293a4033a22..076f43a95e189273d456a019e2ce75f9203e9b17 100644 (file)
@@ -1,28 +1,12 @@
-#ifndef _BABELTRACE_COMPAT_STDIO_H
-#define _BABELTRACE_COMPAT_STDIO_H
-
 /*
- * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ * SPDX-License-Identifier: MIT
  *
- * 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.
+ * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  */
 
+#ifndef _BABELTRACE_COMPAT_STDIO_H
+#define _BABELTRACE_COMPAT_STDIO_H
+
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -37,10 +21,10 @@ char * _bt_getline_bufalloc(char **lineptr, size_t *n, size_t linelen)
        size_t buflen = *n;
        char *buf = *lineptr;
 
-       if (buflen >= linelen && buf != NULL) {
+       if (buflen >= linelen && buf) {
                return buf;
        }
-       if (buf == NULL) {
+       if (!buf) {
                buflen = BT_GETLINE_MINBUFLEN;
        } else {
                buflen = buflen << 1;
@@ -80,7 +64,7 @@ ssize_t bt_getline(char **lineptr, size_t *n, FILE *stream)
        char *buf;
        int found_eof = 0;
 
-       if (lineptr == NULL || n == NULL) {
+       if (!lineptr || !n) {
                errno = EINVAL;
                return -1;
        }
@@ -94,7 +78,7 @@ ssize_t bt_getline(char **lineptr, size_t *n, FILE *stream)
                                /* ferror() is set, errno set by fgetc(). */
                                return -1;
                        }
-                       BT_ASSERT(feof(stream));
+                       BT_ASSERT_DBG(feof(stream));
                        found_eof = 1;
                        break;
                }
This page took 0.023746 seconds and 4 git commands to generate.