I generally prefer the value returned from a function to be the error code
and
function parameters passed to a function call, to also act as the return
method for any extra information which needs returning.

It makes the source look neater.

So I prefer: -
int snd_pcm_mmap_commit(snd_pcm_t *pcm,
                         snd_pcm_uframes_t offset,
                         snd_pcm_uframes_t frames,
                         snd_pcm_uframes_t *committed);


Cheers
James




> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jaroslav
> Kysela
> Sent: 10 December 2001 17:24
> To: ALSA development
> Cc: Abramo Bagnara
> Subject: [Alsa-devel] MMAP direct API change?
>
>
> Hello all,
>
>       I need your advice here. The current snd_pcm_mmap_commit()
> function returns zero or an error. I've added a new function
> snd_pcm_mmap_commit_partial() to detect partial transfers as well:
>
> int snd_pcm_mmap_commit(snd_pcm_t *pcm,
>                         snd_pcm_uframes_t offset,
>                         snd_pcm_uframes_t frames);
> int snd_pcm_mmap_commit_partial(snd_pcm_t *pcm,
>                                 snd_pcm_uframes_t offset,
>                                 snd_pcm_uframes_t frames,
>                                 snd_pcm_uframes_t *commited);
>
> Abramo doesn't like new function so much, so I need your vote here, if:
>
> 1) change snd_pcm_mmap_commit prototype to
>
> snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
>                                     snd_pcm_uframes_t offset,
>                                     snd_pcm_uframes_t frames);
>
> 2) leave the current API as is (two separate commit functions)
>
> 3) remove snd_pcm_mmap_commit() and rename
>    snd_pcm_mmap_commit_partial() to snd_pcm_mmap_commit() although
>    it makes necessary to add an extra parameter to all existing
>    applications (NULL can be taken as "I don't care")
>
>
> I see the benefit of the extra parameter, that we can return the error
> code and transfer count in one pass. Otherwise the error code can be lost
> or returned later using another function like snd_pcm_avail_update() etc..
>
> Opinions?
>
>                                               Jaroslav
>
> -----
> Jaroslav Kysela <[EMAIL PROTECTED]>
> SuSE Linux    http://www.suse.com
> ALSA Project  http://www.alsa-project.org
>
>
>
> _______________________________________________
> Alsa-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/alsa-devel


_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to