diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-29 09:41:59 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-29 09:41:59 +0000 |
commit | 8adeadbdb63e1cb8e4d62fe400ffefada9122d86 (patch) | |
tree | af04b2ac94e7d1d2e0645f305278f6d335f81b66 | |
parent | c64b8d6e884bc587749a3363fc4311a48a4b7b0c (diff) |
Removed duplicate opt->lien_tot and opt->liens members in some functions.
-rw-r--r-- | src/htscore.c | 19 | ||||
-rw-r--r-- | src/htscore.h | 7 | ||||
-rw-r--r-- | src/htsname.c | 3 | ||||
-rw-r--r-- | src/htsparse.c | 34 | ||||
-rw-r--r-- | src/htswizard.c | 11 | ||||
-rw-r--r-- | src/htswizard.h | 4 |
6 files changed, 33 insertions, 45 deletions
diff --git a/src/htscore.c b/src/htscore.c index 531c1f0..c20c2a0 100644 --- a/src/htscore.c +++ b/src/htscore.c @@ -2389,8 +2389,8 @@ int engine_stats(void) { #define _ROBOTS ((robots_wizard*)opt->robotsptr) // bannir host (trop lent etc) -void host_ban(httrackp * opt, lien_url ** liens, int ptr, int lien_tot, - struct_back * sback, char *host) { +void host_ban(httrackp * opt, int ptr, + struct_back * sback, const char *host) { lien_back *const back = sback->lnk; const int back_max = sback->count; @@ -2451,7 +2451,7 @@ void host_ban(httrackp * opt, lien_url ** liens, int ptr, int lien_tot, // effacer liens //l=strlen(host); - for(i = 0; i < lien_tot; i++) { + for(i = 0; i < opt->lien_tot; i++) { //if (heap(i)->adr_len==l) { // même taille de chaîne // Calcul de taille sécurisée if (heap(i)) { @@ -3255,11 +3255,11 @@ int backlinks_done(const struct_back * sback, // remplir backing si moins de max_bytes en mémoire HTS_INLINE int back_fillmax(struct_back * sback, httrackp * opt, - cache_back * cache, lien_url ** liens, int ptr, - int numero_passe, int lien_tot) { + cache_back * cache, int ptr, + int numero_passe) { if (!opt->state.stop) { if (back_incache(sback) < opt->maxcache) { // pas trop en mémoire? - return back_fill(sback, opt, cache, liens, ptr, numero_passe, lien_tot); + return back_fill(sback, opt, cache, ptr, numero_passe); } } return -1; /* plus de place */ @@ -3306,7 +3306,7 @@ int back_pluggable_sockets(struct_back * sback, httrackp * opt) { // remplir backing int back_fill(struct_back * sback, httrackp * opt, cache_back * cache, - lien_url ** liens, int ptr, int numero_passe, int lien_tot) { + int ptr, int numero_passe) { int n = back_pluggable_sockets(sback, opt); if (opt->savename_delayed == 2 && !opt->delayed_cached) /* cancel (always delayed) */ @@ -3322,7 +3322,7 @@ int back_fill(struct_back * sback, httrackp * opt, cache_back * cache, /* on a déja parcouru */ if (p < cache->ptr_ant) p = cache->ptr_ant; - while((p < lien_tot) && (n > 0) && back_checkmirror(opt)) { + while(p < opt->lien_tot && n > 0 && back_checkmirror(opt)) { //while((p<lien_tot) && (n>0) && (p < ptr+opt->maxcache_anticipate)) { int ok = 1; @@ -3794,8 +3794,7 @@ int htsAddLink(htsmoduleStruct * str, char *link) { int just_test_it = 0; forbidden_url = - hts_acceptlink(opt, ptr, opt->lien_tot, opt->liens, adr, fil, NULL, NULL, - &set_prio_to, &just_test_it); + hts_acceptlink(opt, ptr, adr, fil, NULL, NULL, &set_prio_to, &just_test_it); hts_log_print(opt, LOG_DEBUG, "result for wizard external module link: %d", forbidden_url); diff --git a/src/htscore.h b/src/htscore.h index b4d0ad8..35593d1 100644 --- a/src/htscore.h +++ b/src/htscore.h @@ -337,8 +337,7 @@ int filesave(httrackp * opt, const char *adr, int len, const char *s, char *hts_cancel_file_pop(httrackp * opt); int check_fatal_io_errno(void); int engine_stats(void); -void host_ban(httrackp * opt, lien_url ** liens, int ptr, int lien_tot, - struct_back * sback, char *host); +void host_ban(httrackp * opt, int ptr, struct_back * sback, const char *host); FILE *filecreate(filenote_strc * strct, const char *s); FILE *fileappend(filenote_strc * strct, const char *s); int filecreateempty(filenote_strc * strct, const char *filename); @@ -371,11 +370,11 @@ int liens_record(char *adr, char *fil, char *save, char *former_adr, int back_pluggable_sockets(struct_back * sback, httrackp * opt); int back_pluggable_sockets_strict(struct_back * sback, httrackp * opt); int back_fill(struct_back * sback, httrackp * opt, cache_back * cache, - lien_url ** liens, int ptr, int numero_passe, int lien_tot); + int ptr, int numero_passe); int backlinks_done(const struct_back * sback, lien_url ** liens, int lien_tot, int ptr); int back_fillmax(struct_back * sback, httrackp * opt, cache_back * cache, - lien_url ** liens, int ptr, int numero_passe, int lien_tot); + int ptr, int numero_passe); int ask_continue(httrackp * opt); int nombre_digit(int n); diff --git a/src/htsname.c b/src/htsname.c index 7b25627..ace3a33 100644 --- a/src/htsname.c +++ b/src/htsname.c @@ -500,8 +500,7 @@ int url_savename(char *adr_complete, char *fil_complete, char *save, back_wait(sback, opt, cache, 0); } if (ptr >= 0) { - back_fillmax(sback, opt, cache, liens, ptr, numero_passe, - lien_tot); + back_fillmax(sback, opt, cache, ptr, numero_passe); } // on est obligé d'appeler le shell pour le refresh.. // Transfer rate diff --git a/src/htsparse.c b/src/htsparse.c index 032af7c..820af38 100644 --- a/src/htsparse.c +++ b/src/htsparse.c @@ -2425,7 +2425,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) { hts_log_print(opt, LOG_DEBUG, "wizard link test at %s%s..", adr, fil); forbidden_url = - hts_acceptlink(opt, ptr, opt->lien_tot, opt->liens, adr, fil, + hts_acceptlink(opt, ptr, adr, fil, intag_name ? intag_name : NULL, intag_name ? tag_attr_start : NULL, &set_prio_to, &just_test_it); @@ -2492,8 +2492,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) { "wizard moved link retest at %s%s..", adr, fil); forbidden_url = - hts_acceptlink(opt, ptr, opt->lien_tot, opt->liens, adr, - fil, + hts_acceptlink(opt, ptr, adr, fil, intag_name ? intag_name : NULL, intag_name ? tag_attr_start : NULL, &set_prio_to, @@ -3337,7 +3336,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) { opt->state._hts_in_html_poll = 0; // temps à attendre, et remplir autant que l'on peut le cache (backing) back_wait(sback, opt, cache, HTS_STAT.stat_timestart); - back_fillmax(sback, opt, cache, opt->liens, ptr, numero_passe, opt->lien_tot); + back_fillmax(sback, opt, cache, ptr, numero_passe); // Transfer rate engine_stats(); @@ -3368,7 +3367,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) { // refresh the backing system each 2 seconds if (engine_stats()) { back_wait(sback, opt, cache, HTS_STAT.stat_timestart); - back_fillmax(sback, opt, cache, opt->liens, ptr, numero_passe, opt->lien_tot); + back_fillmax(sback, opt, cache, ptr, numero_passe); } } while((((int) (adr - r->adr))) < r->size); @@ -3498,7 +3497,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str, "wizard link test for moved file at %s%s..", mov_adr, mov_fil); // accepté? - if (hts_acceptlink(opt, ptr, opt->lien_tot, opt->liens, mov_adr, mov_fil, NULL, NULL, &set_prio_to, NULL) != 1) { /* nouvelle adresse non refusée ? */ + if (hts_acceptlink(opt, ptr, mov_adr, mov_fil, NULL, NULL, &set_prio_to, NULL) != 1) { /* nouvelle adresse non refusée ? */ get_it = 1; hts_log_print(opt, LOG_DEBUG, "moved link accepted: %s%s", mov_adr, mov_fil); @@ -3675,8 +3674,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str, if (opt->hostcontrol) { // timeout et retry épuisés if ((opt->hostcontrol & 1) && (heap(ptr)->retry <= 0)) { hts_log_print(opt, LOG_DEBUG, "Link banned: %s%s", urladr(), urlfil()); - host_ban(opt, opt->liens, ptr, opt->lien_tot, sback, - jump_identification(urladr())); + host_ban(opt, ptr, sback, jump_identification(urladr())); hts_log_print(opt, LOG_DEBUG, "Info: previous log - link banned: %s%s", urladr(), urlfil()); @@ -3689,8 +3687,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str, if ((opt->hostcontrol) && (heap(ptr)->retry <= 0)) { // too slow if (opt->hostcontrol & 2) { hts_log_print(opt, LOG_DEBUG, "Link banned: %s%s", urladr(), urlfil()); - host_ban(opt, opt->liens, ptr, opt->lien_tot, sback, - jump_identification(urladr())); + host_ban(opt, ptr, sback, jump_identification(urladr())); hts_log_print(opt, LOG_DEBUG, "Info: previous log - link banned: %s%s", urladr(), urlfil()); @@ -4078,7 +4075,7 @@ int hts_mirror_wait_for_next_file(htsmoduleStruct * str, if ((n > 0) && (!opt->state._hts_setpause)) { // si sockets libre et pas en pause, ajouter // remplir autant que l'on peut le cache (backing) - back_fillmax(sback, opt, cache, opt->liens, ptr, numero_passe, opt->lien_tot); + back_fillmax(sback, opt, cache, ptr, numero_passe); } // index du lien actuel { @@ -4119,7 +4116,7 @@ int hts_mirror_wait_for_next_file(htsmoduleStruct * str, } // And fill the backing stack if (back[b].status > 0) - back_fillmax(sback, opt, cache, opt->liens, ptr, numero_passe, opt->lien_tot); + back_fillmax(sback, opt, cache, ptr, numero_passe); // Continue to the loop if link still present b = back_index(opt, sback, urladr(), urlfil(), savename()); @@ -4467,8 +4464,7 @@ int hts_wait_delayed(htsmoduleStruct * str, char *adr, char *fil, char *save, /* Recompute authorization with MIME type */ { int new_forbidden_url = - hts_acceptmime(opt, ptr, opt->lien_tot, opt->liens, adr, fil, - back.r.contenttype); + hts_acceptmime(opt, ptr, adr, fil, back.r.contenttype); if (new_forbidden_url != -1) { hts_log_print(opt, LOG_DEBUG, "result for wizard mime test: %d", new_forbidden_url); @@ -4541,8 +4537,7 @@ int hts_wait_delayed(htsmoduleStruct * str, char *adr, char *fil, char *save, /* Recompute authorization with MIME type */ { int new_forbidden_url = - hts_acceptmime(opt, ptr, opt->lien_tot, opt->liens, adr, fil, - delayed_back.r.contenttype); + hts_acceptmime(opt, ptr, adr, fil, delayed_back.r.contenttype); if (new_forbidden_url != -1) { hts_log_print(opt, LOG_DEBUG, "result for wizard mime test: %d", *forbidden_url); @@ -4591,7 +4586,7 @@ int hts_wait_delayed(htsmoduleStruct * str, char *adr, char *fil, char *save, back_wait(sback, opt, cache, 0); } if (ptr >= 0) { - back_fillmax(sback, opt, cache, opt->liens, ptr, numero_passe, opt->lien_tot); + back_fillmax(sback, opt, cache, ptr, numero_passe); } // on est obligé d'appeler le shell pour le refresh.. { @@ -4691,7 +4686,7 @@ int hts_wait_delayed(htsmoduleStruct * str, char *adr, char *fil, char *save, { int set_prio_to = 0; - if (hts_acceptlink(opt, ptr, opt->lien_tot, opt->liens, mov_adr, mov_fil, NULL, NULL, &set_prio_to, NULL) == 1) { /* forbidden */ + if (hts_acceptlink(opt, ptr, mov_adr, mov_fil, NULL, NULL, &set_prio_to, NULL) == 1) { /* forbidden */ /* Note: the cache 'cached_tests' system will remember this error, and we'll only issue ONE request */ *forbidden_url = 1; /* Forbidden! */ hts_log_print(opt, LOG_DEBUG, @@ -4744,8 +4739,7 @@ int hts_wait_delayed(htsmoduleStruct * str, char *adr, char *fil, char *save, /* Recompute authorization with MIME type */ { int new_forbidden_url = - hts_acceptmime(opt, ptr, opt->lien_tot, opt->liens, adr, fil, - delayed_back.r.contenttype); + hts_acceptmime(opt, ptr, adr, fil, delayed_back.r.contenttype); if (new_forbidden_url != -1) { hts_log_print(opt, LOG_DEBUG, "result for wizard mime test: %d", *forbidden_url); diff --git a/src/htswizard.c b/src/htswizard.c index 7273ce1..af364db 100644 --- a/src/htswizard.c +++ b/src/htswizard.c @@ -75,8 +75,7 @@ htspair_t hts_detect_embed[] = { }; /* Internal */ -static int hts_acceptlink_(httrackp * opt, int ptr, int lien_tot, - lien_url ** liens, const char *adr, +static int hts_acceptlink_(httrackp * opt, int ptr, const char *adr, const char *fil, const char *tag, const char *attribute, int *set_prio_to, int *just_test_it); @@ -102,11 +101,10 @@ retour: */ int hts_acceptlink(httrackp * opt, int ptr, - int lien_tot, lien_url ** liens, const char *adr, const char *fil, const char *tag, const char *attribute, int *set_prio_to, int *just_test_it) { - int forbidden_url = hts_acceptlink_(opt, ptr, lien_tot, liens, + int forbidden_url = hts_acceptlink_(opt, ptr, adr, fil, tag, attribute, set_prio_to, just_test_it); int prev_prio = set_prio_to ? *set_prio_to : 0; @@ -132,8 +130,7 @@ static int cmp_token(const char *tag, const char *cmp) { && !isalnum((unsigned char) tag[p])); } -static int hts_acceptlink_(httrackp * opt, int ptr, int lien_tot, - lien_url ** liens, +static int hts_acceptlink_(httrackp * opt, int ptr, const char *adr, const char *fil, const char *tag, const char *attribute, int *set_prio_to, int *just_test_it) { @@ -863,7 +860,7 @@ static int hts_acceptlink_(httrackp * opt, int ptr, int lien_tot, #undef _ROBOTS } -int hts_acceptmime(httrackp * opt, int ptr, int lien_tot, lien_url ** liens, +int hts_acceptmime(httrackp * opt, int ptr, const char *adr, const char *fil, const char *mime) { #define _FILTERS (*opt->filters.filters) #define _FILTERS_PTR (opt->filters.filptr) diff --git a/src/htswizard.h b/src/htswizard.h index b4d10f8..42a3e43 100644 --- a/src/htswizard.h +++ b/src/htswizard.h @@ -49,12 +49,12 @@ typedef struct httrackp httrackp; typedef struct lien_url lien_url; #endif -int hts_acceptlink(httrackp * opt, int ptr, int lien_tot, lien_url ** liens, +int hts_acceptlink(httrackp * opt, int ptr, const char *adr, const char *fil, const char *tag, const char *attribute, int *set_prio_to_0, int *just_test_it); int hts_testlinksize(httrackp * opt, const char *adr, const char *fil, LLint size); -int hts_acceptmime(httrackp * opt, int ptr, int lien_tot, lien_url ** liens, +int hts_acceptmime(httrackp * opt, int ptr, const char *adr, const char *fil, const char *mime); #endif |