Denis Zaitsev writes:
> This little patch does nothing with the functionality of devfsd, but
> with the C code. There are a number of constructions like:
>
> [PFXLEN = strlen(prefix);]
> if (strncmp(str, prefix, PFXLEN) == 0)
> do_something_with(str + PFXLEN);
>
> It is not the best way to do such a things. The idea is to implement
> the special function, which will test the string for some prefix and
> return the address of a place of the string after that prefix or NULL
> in case of an absence of the success. The construction above becomes
> better:
>
> if (ptr= strtry(str, prefix))
> do_something_with(ptr);
>
> And the new function itself is more lightweight than alone strncmp,
> and just much more effective than <strlen + strncmp> in a couple. It
> is good again. So, all the idea seems to be healthy. I call this
> function "strtry", as it tries its arg for the given prefix.
Apart from not really liking this approach, you've made the strtry()
function inlined. Any saving you might make with removing code from
the callers is probably more than lost due to all the extra inlined
code.
Did you compare the sizes of the stripped binary to see what the
effect of your patch is?
> Richard, please, apply this patch, if you find it useful. It is
> against devfsd-1.3.22. By the way, I've arranged the
> strrchr (devname, '/') + 1
> stuff, so this thing to be done once instead of multiply times in the
> original.
But you've inserted calls to strrchr in cases where it's not really
needed.
BTW: linux-kernel isn't the right place to discuss devfsd
development. The right place is devfs@oss.sgi.com (I've set Reply-To:
to do this).
Regards,
Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca
-
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/
This archive was generated by hypermail 2b29 : Sat Feb 23 2002 - 21:00:21 EST