]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commit
Constify argv, fix warnings. (#1242)
authorMichal Suchánek <hramrach@gmail.com>
Fri, 5 Jan 2024 14:31:48 +0000 (15:31 +0100)
committerGitHub <noreply@github.com>
Fri, 5 Jan 2024 14:31:48 +0000 (15:31 +0100)
commitb76e3c578f1e9f582e9c28f50d82b1f569602075
tree0aa1abb9c7835cbc04eace56892149d71a512e6e
parentc1be8ba03ffdd11532f68b4e7411dd77f1255b18
Constify argv, fix warnings. (#1242)

* Fix perl warnings

 - cast POPs to void to avoid unused value warning
 - declare functions that don't set RETVAL as returning void

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
* Constify argv

rrd has no business modifying the string pointed to by passed agrv, and
as far as gcc can see it does indeed not modify them because it compiles
with const argv.

This fixes warnings when passing const strings into rrd, and avoids the
need to duplicate all strings in the tcl bindings.

This fixes warnings like these:
[    3s] prog/sensord/rrd.c: In function 'rrdInit':
[    3s] prog/sensord/rrd.c:302:40: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
[    3s]   302 |                 ret = rrd_create(argc, (char**) argv);
[    3s]       |                                        ^
[    3s] prog/sensord/rrd.c: In function 'rrdUpdate':
[    3s] prog/sensord/rrd.c:458:42: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
[    3s]   458 |                 if ((ret = rrd_update(3, (char **) /* WEAK */ argv))) {
[    3s]       |                                          ^

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
* tcl: Do not duplicate const strings

---------

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
32 files changed:
CHANGES
bindings/lua/rrdlua.c
bindings/perl-shared/RRDs.xs
bindings/python/rrdtoolmodule.c
bindings/ruby/main.c
bindings/tcl/tclrrd.c
src/optparse.c
src/optparse.h
src/rrd.h
src/rrd_cgi.c
src/rrd_create.c
src/rrd_daemon.c
src/rrd_dump.c
src/rrd_fetch.c
src/rrd_first.c
src/rrd_flushcached.c
src/rrd_graph.c
src/rrd_graph.h
src/rrd_graph_helper.c
src/rrd_info.c
src/rrd_last.c
src/rrd_lastupdate.c
src/rrd_list.c
src/rrd_modify.c
src/rrd_modify.h
src/rrd_resize.c
src/rrd_restore.c
src/rrd_tool.c
src/rrd_tune.c
src/rrd_update.c
src/rrd_xport.c
src/rrdupdate.c