Fix compiler warnings related to 'const'
This commit is contained in:
@@ -26,6 +26,10 @@
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
|
||||
#ifndef discard_const
|
||||
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
||||
#endif
|
||||
|
||||
const char *initiator = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-readcapacity16";
|
||||
|
||||
void print_usage(void)
|
||||
@@ -58,7 +62,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 show_help = 0, show_usage = 0, debug = 0, size_only=0;
|
||||
int res;
|
||||
@@ -119,8 +123,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));
|
||||
|
||||
Reference in New Issue
Block a user