diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-29 17:29:02 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-29 17:29:02 +0000 |
commit | 8dd39bc909a7c9fdca1009f1e375de756149e4d7 (patch) | |
tree | ea4062c66ae0b5e9a23ed85ab8aa8458c59b5b98 /src | |
parent | 17ec3ecd6b8d4d5f19f5d50ce34b8bfa2894c3be (diff) |
Take in account opt->maxlink is non-zero
Diffstat (limited to 'src')
-rw-r--r-- | src/htscore.c | 5 | ||||
-rw-r--r-- | src/htsglobal.h | 21 | ||||
-rw-r--r-- | src/htslib.c | 7 |
3 files changed, 6 insertions, 27 deletions
diff --git a/src/htscore.c b/src/htscore.c index d2d396d..e0fdcc9 100644 --- a/src/htscore.c +++ b/src/htscore.c @@ -263,6 +263,11 @@ static size_t hts_record_link_alloc(httrackp *opt) { assertf(opt != NULL); assertf(liensbuf != NULL); + // Limit the number of links + if (opt->maxlink > 0 && TypedArraySize(liensbuf->ptr) >= opt->maxlink) { + return (size_t) -1; + } + // Create a new chunk of lien_url[] // There are references to item pointers, so we can not just realloc() if (liensbuf->lien_buffer_size == liensbuf->lien_buffer_capa) { diff --git a/src/htsglobal.h b/src/htsglobal.h index bd10b39..60e1240 100644 --- a/src/htsglobal.h +++ b/src/htsglobal.h @@ -132,11 +132,6 @@ Please visit our Website: http://www.httrack.com #endif -// don't spare memory usage by default -#ifndef HTS_SPARE_MEMORY -#define HTS_SPARE_MEMORY 0 -#endif - #ifndef BIGSTK #define BIGSTK #endif @@ -206,17 +201,10 @@ Please visit our Website: http://www.httrack.com #endif -#if HTS_SPARE_MEMORY==0 /* Taille max d'une URL */ #define HTS_URLMAXSIZE 1024 /* Taille max ligne de commande (>=HTS_URLMAXSIZE*2) */ #define HTS_CDLMAXSIZE 1024 -#else -/* Taille max d'une URL */ -#define HTS_URLMAXSIZE 256 -/* Taille max ligne de commande (>=HTS_URLMAXSIZE*2) */ -#define HTS_CDLMAXSIZE 1024 -#endif /* Copyright (C) 1998-2014 Xavier Roche and other contributors */ #define HTTRACK_AFF_AUTHORS "[XR&CO'2014]" @@ -335,11 +323,6 @@ typedef unsigned __int32 T_SOC; typedef int T_SOC; #endif -/* Default alignement */ -#ifndef HTS_ALIGN -#define HTS_ALIGN (sizeof(void*)) -#endif - /* IPV4, IPV6 and various unified structures */ #define HTS_MAXADDRLEN 64 @@ -384,11 +367,7 @@ typedef int T_SOC; #define LOCAL_SOCKET_ID -2 // taille de chaque buffer (10 sockets 650 ko) -#if HTS_SPARE_MEMORY==0 #define TAILLE_BUFFER 65536 -#else -#define TAILLE_BUFFER 8192 -#endif #ifdef HTS_DO_NOT_USE_PTHREAD #error needs threads support diff --git a/src/htslib.c b/src/htslib.c index fe2863e..d57ce57 100644 --- a/src/htslib.c +++ b/src/htslib.c @@ -5461,13 +5461,8 @@ HTSEXT_API httrackp *hts_create_opt(void) { StringCopy(opt->path_log, ""); StringCopy(opt->path_bin, ""); // -#if HTS_SPARE_MEMORY==0 - opt->maxlink = 100000; // 100,000 liens max par défaut (400Kb) + opt->maxlink = 100000; // 100,000 liens max par défaut opt->maxfilter = 200; // 200 filtres max par défaut -#else - opt->maxlink = 10000; // 10,000 liens max par défaut (40Kb) - opt->maxfilter = 50; // 50 filtres max par défaut -#endif opt->maxcache = 1048576 * 32; // a peu près 32Mo en cache max -- OPTION NON PARAMETRABLE POUR L'INSTANT -- //opt->maxcache_anticipate=256; // maximum de liens à anticiper opt->maxtime = -1; // temps max en secondes |