Re: 'black list' in drivers/block/ide_modes.h is broken

Peter P. Eiserloh (eiserloh@llab.chinalake.navy.mil)
Tue, 29 Apr 1997 17:25:45 -0700


> Could we not use a chunk of code like
>
> int i, j;
> ...
> i = strlen(p->name);
> j = strlen(model);
> if (strncmp(p->name, model, ( (i > j) ? i : j ));
>
> to take the longer length and compare over that? That chunk of code is, of
> course, nowhere near well-optimized enough. But, I think the general idea
> is sound. Maybe not, though. Let me know what you think.

Why not compare the entire string including the null character,
if the model string is longer it will fail the compare at the null.

if (strncmp(p->name, model, strlen(p->name)+1);

.....................................................................
: Peter "Eyes" Eiserloh eiserloh@llab.chinalake.navy.mil
: None of the opinions expressed here are in any way related those
: of my employer.
: Linux, Modula-2/3, Compilers, Esperanto, Physics, Babylon-5
.....................................................................