OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] vzlist: Fix "cast from pointer to integer of different size" warnings
[PATCH] vzlist: Fix "cast from pointer to integer of different size" warnings [message #5632] Thu, 24 August 2006 21:45 Go to next message
ldv is currently offline  ldv
Messages: 24
Registered: June 2006
Junior Member
vzlist:
id_search_fn(): Take veid by reference like in veid_search_fn().
find_ve(): Pass veid by reference like in check_veid_restr().

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
src/vzlist.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/vzlist.c b/src/vzlist.c
index 3e631ea..f211f11 100644
--- a/src/vzlist.c
+++ b/src/vzlist.c
@@ -607,7 +607,7 @@ void usage()

int id_search_fn(const void* val1, const void* val2)
{
- return ((int)val1 - ((struct Cveinfo*)val2)->veid);
+ return (*(int *)val1 - ((struct Cveinfo*)val2)->veid);
}

int veid_search_fn(const void* val1, const void* val2)
@@ -708,7 +708,7 @@ void add_elem(struct Cveinfo *ve)

inline struct Cveinfo *find_ve(int veid)
{
- return (struct Cveinfo *) bsearch((void*)veid, veinfo, n_veinfo,
+ return (struct Cveinfo *) bsearch(&veid, veinfo, n_veinfo,
sizeof(struct Cveinfo), id_search_fn);
}

--
ldv
Re: [PATCH] vzlist: Fix "cast from pointer to integer of different size" warnings [message #5644 is a reply to message #5632] Fri, 25 August 2006 08:40 Go to previous message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

Dmitry,

thanks a lot for your help!
all 4 patches are commited and can be found at git

Thanks,
Kirill

> vzlist:
> id_search_fn(): Take veid by reference like in veid_search_fn().
> find_ve(): Pass veid by reference like in check_veid_restr().
>
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
> src/vzlist.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/vzlist.c b/src/vzlist.c
> index 3e631ea..f211f11 100644
> --- a/src/vzlist.c
> +++ b/src/vzlist.c
> @@ -607,7 +607,7 @@ void usage()
>
> int id_search_fn(const void* val1, const void* val2)
> {
> - return ((int)val1 - ((struct Cveinfo*)val2)->veid);
> + return (*(int *)val1 - ((struct Cveinfo*)val2)->veid);
> }
>
> int veid_search_fn(const void* val1, const void* val2)
> @@ -708,7 +708,7 @@ void add_elem(struct Cveinfo *ve)
>
> inline struct Cveinfo *find_ve(int veid)
> {
> - return (struct Cveinfo *) bsearch((void*)veid, veinfo, n_veinfo,
> + return (struct Cveinfo *) bsearch(&veid, veinfo, n_veinfo,
> sizeof(struct Cveinfo), id_search_fn);
> }
>
>
>
> ------------------------------------------------------------ ------------
>
Previous Topic: [PATCH] vzctl enter: Forward error messages from child process
Next Topic: [RFC][PATCH] UBC: user resource beancounters
Goto Forum:
  


Current Time: Tue Nov 12 19:41:01 GMT 2024

Total time taken to generate the page: 0.04487 seconds