From 79a9eacaeded9aea74e710e7caa8ccf572ecf30c Mon Sep 17 00:00:00 2001 From: Raymond Li Date: Sat, 18 Jul 2020 21:59:04 -0400 Subject: [PATCH] Merge everything from upstream except PR i3#280 --- .clang-format | 1 + .travis.yml | 6 +----- configure.ac | 1 + i3lock.c | 7 +++---- i3lock.h | 9 +++++---- travis/Dockerfile | 4 ++-- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.clang-format b/.clang-format index 1d84013..6e49d83 100644 --- a/.clang-format +++ b/.clang-format @@ -8,3 +8,4 @@ IndentWidth: 4 PointerBindsToType: false ColumnLimit: 0 SpaceBeforeParens: ControlStatements +SortIncludes: false diff --git a/.travis.yml b/.travis.yml index 15ad1e4..6e929e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,7 @@ language: c compiler: - gcc - clang -addons: - apt: - packages: - - clang-format-3.5 script: - - clang-format-3.5 -i *.[ch] && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false) - docker build --pull --no-cache --rm -t=i3lock -f travis/Dockerfile . + - docker run -e CC=$CC -v $PWD:/usr/src:rw i3lock /bin/sh -c 'clang-format-9 -i *.[ch] && git diff --exit-code || (echo "Code was not formatted using clang-format!"; false)' - docker run -e CC=$CC -v $PWD:/usr/src:rw i3lock /bin/sh -c 'autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j V=1 CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror"' diff --git a/configure.ac b/configure.ac index 4b924db..904b5ae 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,7 @@ AC_FUNC_FORK AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_FUNC_STRNLEN AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3lock requires])]) +AC_CHECK_FUNCS([explicit_bzero]) # Checks for libraries. diff --git a/i3lock.c b/i3lock.c index 0ba3f9a..c6004e0 100644 --- a/i3lock.c +++ b/i3lock.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -29,7 +28,7 @@ #include #include #include -#ifdef __OpenBSD__ +#ifdef HAVE_EXPLICIT_BZERO #include #else #include @@ -45,7 +44,7 @@ #include #include #include -#ifdef __OpenBSD__ +#ifdef HAVE_EXPLICIT_BZERO #include /* explicit_bzero(3) */ #endif #include @@ -906,7 +905,7 @@ static void process_xkb_event(xcb_generic_event_t *gevent) { * and also redraw the image, if any. * */ -void handle_screen_resize(void) { +static void handle_screen_resize(void) { xcb_get_geometry_cookie_t geomc; xcb_get_geometry_reply_t *geom; geomc = xcb_get_geometry(conn, screen->root); diff --git a/i3lock.h b/i3lock.h index 4352ff5..2d20ad1 100644 --- a/i3lock.h +++ b/i3lock.h @@ -8,10 +8,11 @@ * This is important because xautolock (for example) closes stdout/stderr by * default, so just printing something to stdout will lead to the data ending * up on the X11 socket (!). */ -#define DEBUG(fmt, ...) \ - do { \ - if (debug_mode) \ - printf("[i3lock-debug] " fmt, ##__VA_ARGS__); \ + #define DEBUG(fmt, ...) \ + do { \ + if (debug_mode) { \ + fprintf(stderr, "[i3lock-debug] " fmt, ##__VA_ARGS__); \ + } \ } while (0) #endif diff --git a/travis/Dockerfile b/travis/Dockerfile index 5381276..cc2dd7d 100644 --- a/travis/Dockerfile +++ b/travis/Dockerfile @@ -11,7 +11,7 @@ RUN echo 'APT::Acquire::Retries "5";' > /etc/apt/apt.conf.d/80retry # (3608 kB/s)). Hence, let’s stick with httpredir.debian.org (default) for now. # Install mk-build-deps (for installing the i3 build dependencies), -# clang and clang-format-3.8 (for checking formatting and building with clang), +# clang and clang-format-9 (for checking formatting and building with clang), # lintian (for checking spelling errors), # test suite dependencies (for running tests) RUN apt-get update && \ @@ -19,7 +19,7 @@ RUN apt-get update && \ build-essential clang git autoconf automake libxcb-randr0-dev pkg-config libpam0g-dev \ libcairo2-dev libxcb1-dev libxcb-dpms0-dev libxcb-image0-dev libxcb-util0-dev \ libxcb-xrm-dev libev-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev \ - libxkbcommon-x11-dev && \ + libxkbcommon-x11-dev clang-format-9 && \ rm -rf /var/lib/apt/lists/* WORKDIR /usr/src