cvs commit: src/sys/i386/include/pc bios.h src/sys/i386/i386
bios.c
Bruce Evans
bde at zeta.org.au
Fri Jun 4 07:38:20 GMT 2004
On Thu, 3 Jun 2004, Nate Lawson wrote:
> On Thu, 3 Jun 2004, Poul-Henning Kamp wrote:
> > phk 2004/06/03 15:36:24 PDT
> > ...
> > +const u_char *
> > +bios_string(u_int from, u_int to, const u_char *string, int len)
> > +{
> > + const char *t, *te;
> > +
> > + if (len == 0)
> > + len = strlen(string);
> > + t = (const char *)(KERNBASE + from);
> > + te = (const char *)(KERNBASE + to);
> > + for (; t <= te; t++)
> > + if (!memcmp(string, t, len))
> > + return (t);
> > + return (NULL);
> > }
This has some style bugs:
- dubious types for `from' and `to', Should probably be vm_offset_t.
- wrong type for `len'. Should be size_t.
- memcmp() should not be used in the kernel. It doesn't exist in some of
my kernels. In -current, it is just a just a broken wrapper for
bcmp() in the kernel. (memcmp() cannot be implemented using just
bcmp(), since bcmp() returns a 2-state value while memcmp() returns
a 3-state value.)
- boolean comparison for the non-boolean value that should be returned by
memcmp().
Bruce
More information about the cvs-src
mailing list