Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@suse.cz>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Removal of assert() in alsa-lib
Date: Wed, 01 Dec 2004 19:01:37 +0100	[thread overview]
Message-ID: <s5hu0r5nbi6.wl@alsa2.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0412011849430.2108@pnote.perex-int.cz>

At Wed, 1 Dec 2004 18:51:44 +0100 (CET),
Jaroslav wrote:
> 
> On Wed, 1 Dec 2004, Takashi Iwai wrote:
> 
> > The patch attached below is a part of changes to replace the excessive
> > assert() with if & error-return.  It's for some PCM codes only.
> > Any comments are appreciated.
> 
> I think that we should add new macros like SNDERR_VERBOSE etc. to not 
> compile error messages to small version of ALSA library (for embedded 
> devices etc). Almost all current assert()s meet this rule.

Or, let the compiler optimize it.

For example, define like

#if YES_WE_CHECK_SANITY
#define SND_SANITY_CHECK(x) x
#else
#define SND_SANITY_CHECK(x) 0
#endif

so that the code like the following will be removed automatically by
the compiler in the optimized case.

	if (SND_SANITY_CHECK(frames > size)) {
		SNDERR("buffer overflow");
		return -EPIPE;
	}


Takashi


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

  reply	other threads:[~2004-12-01 18:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-01 16:31 Removal of assert() in alsa-lib Takashi Iwai
2004-12-01 17:51 ` Jaroslav Kysela
2004-12-01 18:01   ` Takashi Iwai [this message]
2004-12-02 12:03     ` Takashi Iwai
2004-12-09 16:23       ` Takashi Iwai
2004-12-10  5:46         ` Glenn Maynard
2004-12-10  7:49           ` Jaroslav Kysela
2004-12-10 11:03             ` Takashi Iwai

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=s5hu0r5nbi6.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=perex@suse.cz \
    /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