2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 07:35:26 +00:00

subtract can now return DNS_R_UNCHANGED

This commit is contained in:
Bob Halley
1999-06-17 00:31:32 +00:00
parent b687c057fb
commit 9b6fd12d8e

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: rdataslab.c,v 1.4 1999/06/16 21:03:07 halley Exp $ */ /* $Id: rdataslab.c,v 1.5 1999/06/17 00:31:32 halley Exp $ */
#include <config.h> #include <config.h>
@@ -282,6 +282,7 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab,
unsigned int mcount, scount, count, tlength, tcount; unsigned int mcount, scount, count, tlength, tcount;
isc_region_t mregion, sregion; isc_region_t mregion, sregion;
dns_rdata_t srdata, mrdata; dns_rdata_t srdata, mrdata;
isc_boolean_t removed_something = ISC_FALSE;
/* /*
* Subtract 'sslab' from 'mslab'. * Subtract 'sslab' from 'mslab'.
@@ -335,7 +336,8 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab,
*/ */
tlength += mregion.length + 2; tlength += mregion.length + 2;
tcount++; tcount++;
} } else
removed_something = ISC_TRUE;
mcurrent += mregion.length; mcurrent += mregion.length;
mcount--; mcount--;
} while (mcount > 0); } while (mcount > 0);
@@ -346,6 +348,12 @@ dns_rdataslab_subtract(unsigned char *mslab, unsigned char *sslab,
if (tcount == 0) if (tcount == 0)
return (DNS_R_NXRDATASET); return (DNS_R_NXRDATASET);
/*
* If nothing is going to change, we can stop.
*/
if (!removed_something)
return (DNS_R_UNCHANGED);
/* /*
* Copy the reserved area from the mslab. * Copy the reserved area from the mslab.
*/ */