Fix compiler warnings related to 'const'

This commit is contained in:
Ronnie Sahlberg
2012-11-11 10:03:45 -08:00
parent a5b8224f4e
commit 9eb26a368d
5 changed files with 33 additions and 12 deletions

View File

@@ -24,8 +24,11 @@
#include "iscsi.h"
#include "scsi-lowlevel.h"
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-inq";
#ifndef discard_const
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#endif
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-inq";
void inquiry_block_limits(struct scsi_inquiry_block_limits *inq)
{
@@ -216,7 +219,7 @@ int main(int argc, const char *argv[])
struct iscsi_context *iscsi;
const char **extra_argv;
int extra_argc = 0;
char *url = NULL;
const char *url = NULL;
struct iscsi_url *iscsi_url = NULL;
int evpd = 0, pagecode = 0;
int show_help = 0, show_usage = 0, debug = 0;
@@ -277,8 +280,10 @@ int main(int argc, const char *argv[])
}
iscsi_url = iscsi_parse_full_url(iscsi, url);
if (url) free(url);
if (url) {
free(discard_const(url));
}
if (iscsi_url == NULL) {
fprintf(stderr, "Failed to parse URL: %s\n",
iscsi_get_error(iscsi));