diff mbox

[2/2] src/stat_item.c: fix cast

Message ID 1446839725-21682-3-git-send-email-alexander.huemer@xx.vu
State New
Headers show

Commit Message

Alexander Huemer Nov. 6, 2015, 7:55 p.m. UTC
---
 src/stat_item.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Holger Freyther Nov. 7, 2015, 11:30 a.m. UTC | #1
> On 06 Nov 2015, at 20:55, Alexander Huemer <alexander.huemer@xx.vu> wrote:

Hi Jacob,


> src/stat_item.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/stat_item.c b/src/stat_item.c
> index 0545ea0..7017523 100644
> --- a/src/stat_item.c
> +++ b/src/stat_item.c
> @@ -81,7 +81,7 @@ struct osmo_stat_item_group *osmo_stat_item_group_alloc(void *ctx,
> 		size = (size + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
> 
> 		/* Store offsets into the item array */
> -		group->items[item_idx] = (void *)items_size;
> +		group->items[item_idx] = (struct osmo_stat_item *)items_size;

This will silence the warning but I think we could change the code to be more direct at
the cost of recalculating the offset twice but staying with the pointers of the right type?
Holger Freyther Jan. 15, 2016, 2:03 p.m. UTC | #2
> On 07 Nov 2015, at 12:30, Holger Freyther <holger@freyther.de> wrote:
> 
> 
>> src/stat_item.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/src/stat_item.c b/src/stat_item.c
>> index 0545ea0..7017523 100644
>> --- a/src/stat_item.c
>> +++ b/src/stat_item.c
>> @@ -81,7 +81,7 @@ struct osmo_stat_item_group *osmo_stat_item_group_alloc(void *ctx,
>> 		size = (size + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
>> 
>> 		/* Store offsets into the item array */
>> -		group->items[item_idx] = (void *)items_size;
>> +		group->items[item_idx] = (struct osmo_stat_item *)items_size;
> 
> This will silence the warning but I think we could change the code to be more direct at
> the cost of recalculating the offset twice but staying with the pointers of the right type?

@Jacob: ping?
diff mbox

Patch

diff --git a/src/stat_item.c b/src/stat_item.c
index 0545ea0..7017523 100644
--- a/src/stat_item.c
+++ b/src/stat_item.c
@@ -81,7 +81,7 @@  struct osmo_stat_item_group *osmo_stat_item_group_alloc(void *ctx,
 		size = (size + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
 
 		/* Store offsets into the item array */
-		group->items[item_idx] = (void *)items_size;
+		group->items[item_idx] = (struct osmo_stat_item *)items_size;
 
 		items_size += size;
 	}