From 5389c987a36cd10b87351e7ec2e19b87790f0efb Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 15 Nov 2001 14:14:03 +0000 Subject: [PATCH] Use inttypes.h --- lib/datastruct/list.h | 4 ++-- lib/datastruct/lvm-types.h | 14 +------------- libdm/datastruct/list.h | 4 ++-- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/lib/datastruct/list.h b/lib/datastruct/list.h index ef7e80287..1c4a791c7 100644 --- a/lib/datastruct/list.h +++ b/lib/datastruct/list.h @@ -50,10 +50,10 @@ static inline int list_empty(struct list *head) { for (v = (head)->n; v != head; v = v->n) #define list_item(v, t) \ - ((t *)((char *)(v) - (unsigned int) &((t *) 0)->list)) + ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->list)) /* Given a known element in a known structure, locate the struct list */ #define list_head(v, t, e) \ - (((t *)((char *)(v) - (unsigned int) &((t *) 0)->e))->list) + (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->list) #endif diff --git a/lib/datastruct/lvm-types.h b/lib/datastruct/lvm-types.h index 84b534af8..5d45f828e 100644 --- a/lib/datastruct/lvm-types.h +++ b/lib/datastruct/lvm-types.h @@ -10,19 +10,7 @@ #include "list.h" #include - -typedef __uint8_t uint8_t; -typedef __uint16_t uint16_t; -typedef __uint32_t uint32_t; -typedef __uint64_t uint64_t; - -#if 0 -typedef __int8_t int8_t; -typedef __int16_t int16_t; -typedef __int32_t int32_t; -typedef __int64_t int64_t; -#endif - +#include struct str_list { struct list list; diff --git a/libdm/datastruct/list.h b/libdm/datastruct/list.h index ef7e80287..1c4a791c7 100644 --- a/libdm/datastruct/list.h +++ b/libdm/datastruct/list.h @@ -50,10 +50,10 @@ static inline int list_empty(struct list *head) { for (v = (head)->n; v != head; v = v->n) #define list_item(v, t) \ - ((t *)((char *)(v) - (unsigned int) &((t *) 0)->list)) + ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->list)) /* Given a known element in a known structure, locate the struct list */ #define list_head(v, t, e) \ - (((t *)((char *)(v) - (unsigned int) &((t *) 0)->e))->list) + (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->list) #endif