From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Removal of assert() in alsa-lib Date: Wed, 01 Dec 2004 19:01:37 +0100 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Jaroslav Kysela Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org 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/