Merge pull request #75 from sitsofe/clang

Fix compilation issues under clang
This commit is contained in:
Ronnie Sahlberg
2013-09-10 06:24:08 -07:00
5 changed files with 29 additions and 26 deletions

View File

@@ -33,13 +33,13 @@
#include "iscsi-private.h"
#include "slist.h"
inline void* iscsi_malloc(struct iscsi_context *iscsi, size_t size) {
void* iscsi_malloc(struct iscsi_context *iscsi, size_t size) {
void * ptr = malloc(size);
if (ptr != NULL) iscsi->mallocs++;
return ptr;
}
inline void* iscsi_zmalloc(struct iscsi_context *iscsi, size_t size) {
void* iscsi_zmalloc(struct iscsi_context *iscsi, size_t size) {
void * ptr = malloc(size);
if (ptr != NULL) {
memset(ptr,0x00,size);
@@ -48,7 +48,7 @@ inline void* iscsi_zmalloc(struct iscsi_context *iscsi, size_t size) {
return ptr;
}
inline void* iscsi_realloc(struct iscsi_context *iscsi, void* ptr, size_t size) {
void* iscsi_realloc(struct iscsi_context *iscsi, void* ptr, size_t size) {
void * _ptr = realloc(ptr, size);
if (_ptr != NULL) {
iscsi->reallocs++;
@@ -56,19 +56,19 @@ inline void* iscsi_realloc(struct iscsi_context *iscsi, void* ptr, size_t size)
return _ptr;
}
inline void iscsi_free(struct iscsi_context *iscsi, void* ptr) {
void iscsi_free(struct iscsi_context *iscsi, void* ptr) {
if (ptr == NULL) return;
free(ptr);
iscsi->frees++;
}
inline char* iscsi_strdup(struct iscsi_context *iscsi, const char* str) {
char* iscsi_strdup(struct iscsi_context *iscsi, const char* str) {
char *str2 = strdup(str);
if (str2 != NULL) iscsi->mallocs++;
return str2;
}
inline void* iscsi_szmalloc(struct iscsi_context *iscsi, size_t size) {
void* iscsi_szmalloc(struct iscsi_context *iscsi, size_t size) {
void *ptr;
if (size > iscsi->smalloc_size) return NULL;
if (iscsi->smalloc_free > 0) {
@@ -81,7 +81,7 @@ inline void* iscsi_szmalloc(struct iscsi_context *iscsi, size_t size) {
return ptr;
}
inline void iscsi_sfree(struct iscsi_context *iscsi, void* ptr) {
void iscsi_sfree(struct iscsi_context *iscsi, void* ptr) {
if (ptr == NULL) return;
if (iscsi->smalloc_free == SMALL_ALLOC_MAX_FREE) {
/* SMALL_ALLOC_MAX_FREE should be adjusted that this happens rarely */

View File

@@ -235,7 +235,7 @@ scsi_pr_type_str(enum scsi_persistent_out_type pr_type)
return value_string_find(pr_type_strings, pr_type);
}
inline uint64_t
uint64_t
scsi_get_uint64(const unsigned char *c)
{
uint64_t val;
@@ -248,7 +248,7 @@ scsi_get_uint64(const unsigned char *c)
return val;
}
inline uint32_t
uint32_t
scsi_get_uint32(const unsigned char *c)
{
uint32_t val;
@@ -259,7 +259,7 @@ scsi_get_uint32(const unsigned char *c)
return val;
}
inline uint16_t
uint16_t
scsi_get_uint16(const unsigned char *c)
{
uint16_t val;
@@ -314,7 +314,7 @@ task_get_uint8(struct scsi_task *task, int offset)
}
}
inline void
void
scsi_set_uint64(unsigned char *c, uint64_t v)
{
uint32_t val;
@@ -327,7 +327,7 @@ scsi_set_uint64(unsigned char *c, uint64_t v)
scsi_set_uint32(c, val);
}
inline void
void
scsi_set_uint32(unsigned char *c, uint32_t val)
{
c[0] = val >> 24;
@@ -336,7 +336,7 @@ scsi_set_uint32(unsigned char *c, uint32_t val)
c[3] = val;
}
inline void
void
scsi_set_uint16(unsigned char *c, uint16_t val)
{
c[0] = val >> 8;