]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove isc_mem_{set,get}quota unused functions
authorOndřej Surý <ondrej@sury.org>
Sat, 17 Nov 2018 08:40:40 +0000 (09:40 +0100)
committerOndřej Surý <ondrej@sury.org>
Thu, 22 Nov 2018 15:46:56 +0000 (16:46 +0100)
bin/tests/optional/db_test.c
lib/isc/include/isc/mem.h
lib/isc/mem.c
lib/isc/win32/libisc.def.in

index 29d341a9c2871c2f66742537c77ec72f0dcde697..dbf45f1aefb78e8eefec805faabbcb97ab248897 100644 (file)
@@ -359,7 +359,6 @@ main(int argc, char *argv[]) {
        dbinfo *dbi;
        dns_dbversion_t *version;
        const dns_name_t *origin;
-       size_t memory_quota = 0;
        dns_trust_t trust = 0;
        unsigned int addopts;
        isc_log_t *lctx = NULL;
@@ -411,10 +410,6 @@ main(int argc, char *argv[]) {
                case 'P':
                        pause_every = atoi(isc_commandline_argument);
                        break;
-               case 'Q':
-                       memory_quota = atoi(isc_commandline_argument);
-                       isc_mem_setquota(mctx, memory_quota);
-                       break;
                case 't':
                        type = atoi(isc_commandline_argument);
                        break;
index 89c5c6acc6f1ea3227397f2fe98b6a286192d3b7..6f61c17505ee6a606394a7b6ef363e7b905d0b63 100644 (file)
@@ -333,18 +333,6 @@ isc_mem_setdestroycheck(isc_mem_t *mctx,
  * destroyed and abort the program if any are present.
  */
 
-/*@{*/
-void
-isc_mem_setquota(isc_mem_t *, size_t);
-size_t
-isc_mem_getquota(isc_mem_t *);
-/*%<
- * Set/get the memory quota of 'mctx'.  This is a hard limit
- * on the amount of memory that may be allocated from mctx;
- * if it is exceeded, allocations will fail.
- */
-/*@}*/
-
 size_t
 isc_mem_inuse(isc_mem_t *mctx);
 /*%<
index e9f935ffe35644358baf766e0e57a782b38f6308..cd2066e287c52086bf3f962c6da649fad1361ced 100644 (file)
@@ -135,7 +135,6 @@ struct isc__mem {
        isc_refcount_t          references;
        char                    name[16];
        void *                  tag;
-       size_t                  quota;
        size_t                  total;
        size_t                  inuse;
        size_t                  maxinuse;
@@ -356,18 +355,10 @@ more_basic_blocks(isc__mem_t *ctx) {
        unsigned char *first, *last;
        unsigned char **table;
        unsigned int table_size;
-       size_t increment;
        int i;
 
        /* Require: we hold the context lock. */
 
-       /*
-        * Did we hit the quota for this context?
-        */
-       increment = NUM_BASIC_BLOCKS * ctx->mem_target;
-       if (ctx->quota != 0U && ctx->total + increment > ctx->quota)
-               return (false);
-
        INSIST(ctx->basic_table_count <= ctx->basic_table_size);
        if (ctx->basic_table_count == ctx->basic_table_size) {
                table_size = ctx->basic_table_size + TABLE_INCREMENT;
@@ -397,7 +388,7 @@ more_basic_blocks(isc__mem_t *ctx) {
                ctx->memalloc_failures++;
                return (false);
        }
-       ctx->total += increment;
+       ctx->total += NUM_BASIC_BLOCKS * ctx->mem_target;;
        ctx->basic_table[ctx->basic_table_count] = tmp;
        ctx->basic_table_count++;
        ctx->malloced += NUM_BASIC_BLOCKS * ctx->mem_target;
@@ -498,10 +489,6 @@ mem_getunlocked(isc__mem_t *ctx, size_t size) {
                /*
                 * memget() was called on something beyond our upper limit.
                 */
-               if (ctx->quota != 0U && ctx->total + size > ctx->quota) {
-                       ret = NULL;
-                       goto done;
-               }
                ret = (ctx->memalloc)(ctx->arg, size);
                if (ret == NULL) {
                        ctx->memalloc_failures++;
@@ -794,7 +781,6 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
        isc_refcount_init(&ctx->references, 1);
        memset(ctx->name, 0, sizeof(ctx->name));
        ctx->tag = NULL;
-       ctx->quota = 0;
        ctx->total = 0;
        ctx->inuse = 0;
        ctx->maxinuse = 0;
@@ -1506,37 +1492,6 @@ isc_mem_setdestroycheck(isc_mem_t *ctx0, bool flag) {
        MCTXUNLOCK(ctx, &ctx->lock);
 }
 
-/*
- * Quotas
- */
-
-void
-isc_mem_setquota(isc_mem_t *ctx0, size_t quota) {
-       isc__mem_t *ctx = (isc__mem_t *)ctx0;
-
-       REQUIRE(VALID_CONTEXT(ctx));
-       MCTXLOCK(ctx, &ctx->lock);
-
-       ctx->quota = quota;
-
-       MCTXUNLOCK(ctx, &ctx->lock);
-}
-
-size_t
-isc_mem_getquota(isc_mem_t *ctx0) {
-       isc__mem_t *ctx = (isc__mem_t *)ctx0;
-       size_t quota;
-
-       REQUIRE(VALID_CONTEXT(ctx));
-       MCTXLOCK(ctx, &ctx->lock);
-
-       quota = ctx->quota;
-
-       MCTXUNLOCK(ctx, &ctx->lock);
-
-       return (quota);
-}
-
 size_t
 isc_mem_inuse(isc_mem_t *ctx0) {
        isc__mem_t *ctx = (isc__mem_t *)ctx0;
index 13d4ba58faecbc1c557c4dcab9409d232711b2e0..c1ad8bb250830c9e47d4c68968077f2eea6c2744 100644 (file)
@@ -364,7 +364,6 @@ isc_mem_createx
 isc_mem_destroy
 isc_mem_detach
 isc_mem_getname
-isc_mem_getquota
 isc_mem_gettag
 isc_mem_inuse
 isc_mem_isovermem
@@ -378,7 +377,6 @@ isc_mem_renderxml
 @END LIBXML2
 isc_mem_setdestroycheck
 isc_mem_setname
-isc_mem_setquota
 isc_mem_setwater
 isc_mem_stats
 isc_mem_total