diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/coccinelle/cast_to_larger_sizes.cocci | 20 | ||||
| -rw-r--r-- | tools/coccinelle/same_type_casting.cocci | 7 | ||||
| -rw-r--r-- | tools/gen_northbound_callbacks.c | 2 | ||||
| -rw-r--r-- | tools/gen_yang_deviations.c | 2 | ||||
| -rw-r--r-- | tools/start-stop-daemon.c | 6 |
5 files changed, 32 insertions, 5 deletions
diff --git a/tools/coccinelle/cast_to_larger_sizes.cocci b/tools/coccinelle/cast_to_larger_sizes.cocci new file mode 100644 index 0000000000..d97e1f9c33 --- /dev/null +++ b/tools/coccinelle/cast_to_larger_sizes.cocci @@ -0,0 +1,20 @@ +// spatch -sp_file tools/coccinelle/cast_to_larger_sizes.cocci --recursive-includes ./ + +@r@ +typedef uint8_t; +typedef uint16_t; +typedef uint32_t; +typedef uint64_t; +uint8_t *i8; +position p; +@@ + + \( + (uint64_t *) i8@p\|(uint32_t *) i8@p\|(uint16_t *) i8@p + \) + +@script:python@ +p << r.p; +@@ + +coccilib.report.print_report(p[0],"Bad typecast to larger size") diff --git a/tools/coccinelle/same_type_casting.cocci b/tools/coccinelle/same_type_casting.cocci new file mode 100644 index 0000000000..58fd7569af --- /dev/null +++ b/tools/coccinelle/same_type_casting.cocci @@ -0,0 +1,7 @@ +@@ +type T; +T *ptr; +@@ + +- (T *)ptr ++ ptr diff --git a/tools/gen_northbound_callbacks.c b/tools/gen_northbound_callbacks.c index cbdf01e7b8..7118986854 100644 --- a/tools/gen_northbound_callbacks.c +++ b/tools/gen_northbound_callbacks.c @@ -358,7 +358,7 @@ int main(int argc, char *argv[]) if (argc != 1) usage(EXIT_FAILURE); - yang_init(); + yang_init(false); if (search_path) ly_ctx_set_searchdir(ly_native_ctx, search_path); diff --git a/tools/gen_yang_deviations.c b/tools/gen_yang_deviations.c index f611f1c57e..f908e1fc69 100644 --- a/tools/gen_yang_deviations.c +++ b/tools/gen_yang_deviations.c @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) if (argc != 1) usage(EXIT_FAILURE); - yang_init(); + yang_init(false); /* Load YANG module. */ module = yang_module_load(argv[0]); diff --git a/tools/start-stop-daemon.c b/tools/start-stop-daemon.c index c75306a959..13118a2769 100644 --- a/tools/start-stop-daemon.c +++ b/tools/start-stop-daemon.c @@ -235,7 +235,7 @@ static const char *next_dirname(const char *s) { const char *cur; - cur = (const char *)s; + cur = s; if (*cur != '\0') { for (; *cur != '/'; ++cur) @@ -255,7 +255,7 @@ static void add_namespace(const char *path) const char *nsdirname, *nsname, *cur; struct namespace *namespace; - cur = (const char *)path; + cur = path; nsdirname = nsname = ""; while ((cur = next_dirname(cur))[0] != '\0') { @@ -273,7 +273,7 @@ static void add_namespace(const char *path) badusage("invalid namepspace path"); namespace = xmalloc(sizeof(*namespace)); - namespace->path = (const char *)path; + namespace->path = path; namespace->nstype = nstype; LIST_INSERT_HEAD(&namespace_head, namespace, list); } |
