public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Samuelson <peter@cadcamlab.org>
To: Tom Rini <trini@kernel.crashing.org>
Cc: kbuild-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Subject: Re: [PATCH] Have split-include take another argument
Date: Mon, 11 Nov 2002 17:37:10 -0600	[thread overview]
Message-ID: <20021111233710.GR4182@cadcamlab.org> (raw)
In-Reply-To: <20021111170604.GA658@opus.bloom.county>


[Tom Rini]
> First, does anyone see any problems with the patch itself?

Well,

> -	str_config += sizeof("CONFIG_") - 1;
> +	str_config += strlen(str_split_token);

it does seem a bit inefficient to call strlen() for every single line
of every single source file.  Perhaps today's compilers know that
strlen() is invariant and has no side effects, but I vote you go ahead
and optimise it explicitly.

Peter

--- scripts/split-include.c.trini	2002-11-11 17:34:57.000000000 -0600
+++ scripts/split-include.c	2002-11-11 17:30:45.000000000 -0600
@@ -52,7 +52,7 @@
     FILE * fp_target;
     FILE * fp_find;
 
-    int buffer_size;
+    int buffer_size, split_token_len;
 
     char * line;
     char * old_line;
@@ -72,6 +72,7 @@
     str_file_autoconf = argv[1];
     str_dir_config    = argv[2];
     str_split_token   = argv[3];
+    split_token_len = strlen(str_split_token);
 
     /* Find a buffer size. */
     if (stat(str_file_autoconf, &stat_buf) != 0)
@@ -116,7 +117,7 @@
 	    continue;
 
 	/* Make the output file name. */
-	str_config += strlen(str_split_token);
+	str_config += split_token_len;
 	for (itarget = 0; !isspace(str_config[itarget]); itarget++)
 	{
 	    int c = (unsigned char) str_config[itarget];

  reply	other threads:[~2002-11-11 23:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-11 17:06 [PATCH] Have split-include take another argument Tom Rini
2002-11-11 23:37 ` Peter Samuelson [this message]
2002-11-12 15:09   ` Tom Rini
2002-11-14 21:01 ` Kai Germaschewski
2002-11-14 23:17   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021111233710.GR4182@cadcamlab.org \
    --to=peter@cadcamlab.org \
    --cc=kai@tp1.ruhr-uni-bochum.de \
    --cc=kbuild-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trini@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox