diff --git a/server/amx/amx.c b/server/amx/amx.c index e0b3cf0..c1c09a8 100644 --- a/server/amx/amx.c +++ b/server/amx/amx.c @@ -1265,27 +1265,18 @@ int AMXAPI amx_GetNative(AMX *amx, int index, char *funcname) int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index) { - int first,last,mid,result; + int idx,last; char pname[sNAMEMAX+1]; amx_NumNatives(amx, &last); - last--; /* last valid index is 1 less than the number of functions */ - first=0; - /* binary search */ - while (first<=last) { - mid=(first+last)/2; - amx_GetNative(amx, mid, pname); - result=strcmp(pname,name); - if (result>0) { - last=mid-1; - } else if (result<0) { - first=mid+1; - } else { - *index=mid; + /* linear search, the natives table is not sorted alphabetically */ + for (idx=0; idx