From: Ian Jackson Subject: Re: [PATCH V2] libxl: support custom block hotplug scripts Date: Thu, 2 Aug 2012 17:20:34 +0100 Message-ID: <20506.43218.20724.749302@mariner.uk.xensource.com> References: <84f0686ebcbfb0fa3a43.1343815057@cosworth.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <84f0686ebcbfb0fa3a43.1343815057@cosworth.uk.xensource.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: Ian Campbell Cc: Roger Pau Monne , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("[PATCH V2] libxl: support custom block hotplug scripts"): > libxl: support custom block hotplug scripts Wow. Thanks. Everything looks good apart from this: > DPC->had_depr_prefix=1; DEPRECATE("use `script=...'"); > - SAVESTRING("script", script, yytext); > - } > + if (DPC->disk->script) { > + if (*DPC->disk->script) { > + xlu__disk_err(DPC,yytext,"script respecified"); > + return 0; > + } > + /* do not complain about overwriting empty strings */ > + free(DPC->disk->script); > + } > + DPC->disk->script = malloc(strlen("block-") > + +strlen(yytext) + 1); > + strcpy(DPC->disk->script, "block-"); > + strcat(DPC->disk->script, yytext); Isn't this very like the contents of the savestring() function ? Ie you could do: char *newscript; asprintf(&newscript, ...); savestring(DPC, "script respecified", &DPC->disk->script, newscript); free(newscript); Other places in xl use asprintf so you can use it here. > + } Is this one-character indentation change intentional ? Ian.