Port: Set PATH_MAX on GNU Hurd
[babeltrace.git] / src / common / common.c
index 1a7d57cc2bb420520508336968ef155d6631b6bf..c82bee330c2e2ff963c10a044e5bcdcef63fd813 100644 (file)
@@ -1,25 +1,9 @@
 /*
- * Babeltrace common functions
+ * SPDX-License-Identifier: MIT
  *
  * Copyright 2016 Philippe Proulx <pproulx@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.
- *
- * 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.
+ * Babeltrace common functions
  */
 
 #define BT_LOG_OUTPUT_LEVEL log_level
@@ -43,6 +27,7 @@
 #include "common/macros.h"
 #include "common/common.h"
 #include "compat/unistd.h"
+#include "compat/limits.h"
 
 #ifndef __MINGW32__
 #include <pwd.h>
@@ -783,7 +768,7 @@ bool bt_common_string_is_printable(const char *input)
        BT_ASSERT_DBG(input);
 
        for (ch = input; *ch != '\0'; ch++) {
-               if (!isprint(*ch) && *ch != '\n' && *ch != '\r' &&
+               if (!isprint((unsigned char) *ch) && *ch != '\n' && *ch != '\r' &&
                                *ch != '\t' && *ch != '\v') {
                        printable = false;
                        goto end;
@@ -1470,8 +1455,11 @@ size_t bt_common_get_page_size(int log_level)
                size_t _tmp_fmt_size = (size_t) (fmt_ch - *out_fmt_ch); \
                strncpy(_tmp_fmt, *out_fmt_ch, _tmp_fmt_size);          \
                _tmp_fmt[_tmp_fmt_size] = '\0';                         \
+               _Pragma("GCC diagnostic push")                          \
+               _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
                _count = snprintf(*buf_ch, _size, _tmp_fmt, __VA_ARGS__); \
-               BT_ASSERT_DBG(_count >= 0);                                     \
+               _Pragma("GCC diagnostic pop")                           \
+               BT_ASSERT_DBG(_count >= 0);                             \
                *buf_ch += MIN(_count, _size);                          \
        } while (0)
 
This page took 0.024098 seconds and 4 git commands to generate.