(intmatch): Assumes that struct size is a multiple of sizeof(int), out

of laziness.  The assumption is true on any sane machine, due to
alignment constraints.  But the function doesn't provide enough value
to make me fix or document this.  Remove it.
(lookup): Replace it.
This commit is contained in:
Markus Armbruster 2005-10-29 07:15:14 +00:00
parent b8e2f4a92a
commit 747d1333cc
3 changed files with 11 additions and 30 deletions

View file

@ -30,10 +30,6 @@
* Known contributors to this file:
* (List known contributors to this file)
*/
/*
* XXX These routines gamble that structures are all longword-aligned.
* If this is not true, they will BREAK!
*/
#include "misc.h"
#include "player.h"
@ -41,22 +37,6 @@
#include "match.h"
#include "prototypes.h"
/*
* find a matching integer from a member of a structure.
* Inspired by stmtch above.
*/
int
intmatch(register int value, register int *ptr, int size)
{
register int i;
size /= sizeof(*ptr);
for (i = 0; *ptr; i++, ptr += size)
if (value == *ptr)
return i;
return -1;
}
/*
* Search for COMMAND in COMS[], return its index.
* Return M_NOTFOUND if there are no matches, M_NOTUNIQUE if there are