From: Ian Jackson Subject: Re: [PATCH RFC] libxl: support for using 'MmGg' as memory size suffix Date: Fri, 11 Oct 2013 12:35:56 +0100 Message-ID: <21079.58012.721045.711808@mariner.uk.xensource.com> References: <1379778703-26986-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1379778703-26986-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Wei Liu writes ("[PATCH RFC] libxl: support for using 'MmGg' as memory size suffix"): > Modify lexer to special-case memory size string. Introduce > xlu_cfg_get_memsize to parse memroy size strings. Urgh, this is really quite an ugly special case. Perhaps a better approach might be to just permit unquoted strings when the string is vaguely like a token, and return the token type STRING from the lexer in that case. > + if ((*ep!='M' && *ep!='m' && *ep!='G' && *ep!='g') || ... > + if (*ep=='G' || *ep=='g') { Surely this should be done with switch(). Ian.