Re: [PATCH] Have split-include take another argument

Peter Samuelson (peter@cadcamlab.org)
Mon, 11 Nov 2002 17:37:10 -0600


[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];
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/