diff mbox

[6/8] semodule_deps: hide -Wwrite-strings warnings

Message ID 20170205155820.29157-6-nicolas.iooss@m4x.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicolas Iooss Feb. 5, 2017, 3:58 p.m. UTC
generate_requires() may use a non-freable strings, BASE_NAME, as key in
a hashtable. The compiler complains about this small abuse of
hashtab_insert() interface (because its argument key is char* without
"const"). Nevertheless this is all right because the hashtab keys are
never freed directly (this behavior is documented in a comment in
free_requires()).

Therefore, hide the compiler warning by casting BASE_NAME to char*.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 semodule-utils/semodule_deps/semodule_deps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/semodule-utils/semodule_deps/semodule_deps.c b/semodule-utils/semodule_deps/semodule_deps.c
index ab99d159f788..8048ee02d3ca 100644
--- a/semodule-utils/semodule_deps/semodule_deps.c
+++ b/semodule-utils/semodule_deps/semodule_deps.c
@@ -40,7 +40,7 @@  extern int optind;
  * thing is done in the linker for displaying error
  * messages.
  */
-#define BASE_NAME "BASE"
+#define BASE_NAME ((char *)"BASE")
 
 static void usage(char *program_name)
 {