From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-x22c.google.com (mail-we0-x22c.google.com [IPv6:2a00:1450:400c:c03::22c]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 4FD5878463 for ; Mon, 10 Feb 2014 02:18:37 -0800 (PST) Received: by mail-we0-f172.google.com with SMTP id p61so4092472wes.31 for ; Mon, 10 Feb 2014 02:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=0qdWguXYQv3erDuD6Ch5dQHXbpKHM6n5ug/wM8Yibgk=; b=VQU/P2ljCX/1OKxYGJlX+locchsfhXEOc8E6q1mUzLNvENox7jkGtzN4kbQHYG/nBQ HIzZQHYP/wpct7WxxHUYNKfpCnqQRuNsRrGQyCxclrldx478mv95Nu1Drp94KZihLswy UBACqv0FrncgCXlG7ikeZywW4cU41Su1g05idM0Pzv5TirSVXuQZetVCGZdgtwnbKfxp /hxGW8ab9u/20GUG17s/uaJJnXHlCUrJU1d6mXO1YK+0KgW8CVYaoODQqgl/4YIXfkja te8sV9TbA+SRPljfWEjznLCmbc+5hDO8zABrS15N+i0zXxPajSwBlCsRmXjwKwY9GeGs ot2A== X-Received: by 10.180.92.169 with SMTP id cn9mr9585595wib.35.1392027475219; Mon, 10 Feb 2014 02:17:55 -0800 (PST) Received: from toaster.adamthompson.me.uk (toaster.adamthompson.me.uk. [2001:8b0:1142:9042::2]) by mx.google.com with ESMTPSA id ju6sm34036533wjc.1.2014.02.10.02.17.52 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Feb 2014 02:17:53 -0800 (PST) Date: Mon, 10 Feb 2014 10:17:49 +0000 From: Adam Thompson To: Chris Brannon Message-ID: <20140210101749.GK11542@toaster.adamthompson.me.uk> References: <20140109160251.eklhad@comcast.net> <87r47cdkhb.fsf@mushroom.PK5001Z> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r47cdkhb.fsf@mushroom.PK5001Z> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Edbrowse-dev@lists.the-brannons.com Subject: Re: [Edbrowse-dev] error legs first step X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Feb 2014 10:18:37 -0000 On Sun, Feb 09, 2014 at 01:50:08PM -0800, Chris Brannon wrote: > Karl Dahlke writes: > > > I think the first step in error legs is to allow for the possibility > > of cw->jss = null. > > It would become null if we encountered an error, > > This sounds good to me. Same here. To be honest, I've half been thinking of making a macro to do something like: #define SWITCH_COMPARTMENT(retval) if ((cw->jss == NULL) || (cw->jss->jcx == NULL)) \ return (retval); \ JSAutoCompartment ac(cw->jss->jcx, cw->jss->jwin) Usage would probably look like (for an eb_bool function): SWITCH_COMPARTMENT(eb_false); For a void function it would be: SWITCH_COMPARTMENT(void); This needs to be a macro for the return, and of course assumes we never use ac as a var name for something else (could be made a parameter if we need). Cheers, Adam.