From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Thu, 18 Aug 2011 10:14:18 -0500 Subject: [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function In-Reply-To: <4E4C5CFF.9020307@gmail.com> References: <1313562246-24627-1-git-send-email-Chunhe.Lan@freescale.com> <4E4C5CFF.9020307@gmail.com> Message-ID: <4E4D2C4A.7050204@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/17/2011 07:29 PM, Jerry Van Baren wrote: > Hi Chunhe Lan, > > On 08/17/2011 02:24 AM, Chunhe Lan wrote: > > [snip] > >> + >> +static inline void do_fixup_by_path_string(void *fdt, const char *path, >> + const char *prop, const char *status) >> +{ >> + do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1); >> +} >> + > > After all the good advice from Scott et al., the patch turns into a > pretty trivial one-liner. I am questioning the advantage of calling > do_fixup_by_path_string(fdt, path, prop, status); > vs. simply calling > do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1); > > The do_fixup_by_path_string() saves two parameters > "strlen(status) + 1, 1" > at the cost of Yet Another Function. Is it worth it? I think it's a nice convenience, with no runtime cost. It avoids any chance of a mismatch between the string passed to do_fixup_by_path and the string passed to strlen. More functions versus open-coding is not generally a bad thing. -Scott