linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sylvain Munaut <tnt@246tNt.com>
To: Timur Tabi <timur@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: Why do the rh_alloc functions return a pointer?
Date: Thu, 15 Feb 2007 21:30:03 +0100	[thread overview]
Message-ID: <45D4C2CB.2080703@246tNt.com> (raw)
In-Reply-To: <45D4B486.7030409@freescale.com>

Timur Tabi wrote:
> The rh_alloc functions (rh_alloc, rh_alloc_fixed, rh_alloc_align) all return a 
> "void *".  However, the actual value passed is an offset into a block of memory. 
>   In most cases, the first time rh_alloc is called, it returns zero.
>
> There are several wrapper functions for rh_alloc, and all of them cast the 
> return value to an unsigned integer.
>
> So my question is, why do the rh_alloc functions return a pointer?  Shouldn't 
> they all return a u32 or uint?
>   
I talked about it with Panto on IRC a few days ago.

And he agrees that the function could be changed to user "unsigned long"
instead of "void *".

Note the long and not int. Because an user may want it to manage pointer
directly so
it must stiff be able to handle pointer even in 64 bits.
But since all current user use rh to manage offset changing it to
"unsigned long" and
getting rid of the unnecessary casts would be a good idea IMHO.


    Sylvain

  reply	other threads:[~2007-02-15 20:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-15 19:29 Why do the rh_alloc functions return a pointer? Timur Tabi
2007-02-15 20:30 ` Sylvain Munaut [this message]
2007-02-15 20:34   ` Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45D4C2CB.2080703@246tNt.com \
    --to=tnt@246tnt.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).