X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fgeneral.c;h=33946ad905c53663808db3b6c2645301fa6a80c7;hb=eaa4473118b245a9dc1d806309eb70d4b2c6eaa4;hp=45aec6894d319cd0e3d0d86f632a3b6c2698d418;hpb=36369543b62cd8922a096f7877036ec8497bc5a9;p=adns.git diff --git a/src/general.c b/src/general.c index 45aec68..33946ad 100644 --- a/src/general.c +++ b/src/general.c @@ -4,7 +4,7 @@ * - vbuf handling */ /* - * This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson + * This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -254,13 +254,15 @@ const char *adns_strerror(adns_status st) { } void adns__isort(void *array, int nobjs, int sz, void *tempbuf, - int (*needswap)(const void *a, const void *b)) { + int (*needswap)(void *context, const void *a, const void *b), + void *context) { byte *data= array; int i, place; for (i=0; i0 && needswap(data + (place-1)*sz, data + i*sz); place--); - + for (place= i; + place>0 && needswap(context, data + (place-1)*sz, data + i*sz); + place--); if (place != i) { memcpy(tempbuf, data + i*sz, sz); memmove(data + (place+1)*sz, data + place*sz, (i-place)*sz);