This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository terminology.

View the commit online.

commit 9963645ba72d0ba7c3c6399dfc75b317845ea818
Author: Boris Faure <[email protected]>
AuthorDate: Thu Jun 23 23:09:48 2022 +0200

    coccinelle: check return type
---
 scripts/coccinelle/bad_return_type.cocci | 34 ++++++++++++++++++++++++++++++++
 src/bin/private.h                        |  2 +-
 src/bin/termptyesc.c                     |  2 +-
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/scripts/coccinelle/bad_return_type.cocci b/scripts/coccinelle/bad_return_type.cocci
new file mode 100644
index 0000000..7ee70ce
--- /dev/null
+++ b/scripts/coccinelle/bad_return_type.cocci
@@ -0,0 +1,34 @@
+@@
+type T, B != T;
+identifier func, i;
+_expression_ E;
+@@
+
+T func (...) {
+...
+(
+T i;
+|
+T i = E;
+|
+static B i;
+|
+static B i = E;
+|
+-B i;
++T i;
+|
+-B i = E;
++T i = E;
+)
+<+...
+(
+return i;
+|
+return (T) i;
+)
+...+>
+}
+
+
+
diff --git a/src/bin/private.h b/src/bin/private.h
index 7fa997c..db3e586 100644
--- a/src/bin/private.h
+++ b/src/bin/private.h
@@ -62,7 +62,7 @@ extern int _log_domain;
    (!strncmp(STR, STATIC_STR, strlen(STATIC_STR)))
 
 #if !defined(HAVE_STRCHRNUL)
-static inline char *
+static inline const char *
 strchrnul(const char *s, int c)
 {
    const char *p = s;
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 419e01e..5e37ec0 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -4489,7 +4489,7 @@ _handle_esc_dcs(Termpty *ty,
      }
    *b = 0;
    if ((*cc == ST) || (*cc == '\\')) cc++;
-   else return 0;
+   else {return 0};
    len = cc - c;
    switch (buf[0])
      {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to