diff options
-rw-r--r-- | src/htscore.c | 8 | ||||
-rw-r--r-- | src/htscore.h | 3 | ||||
-rw-r--r-- | src/htshash.c | 11 | ||||
-rw-r--r-- | src/htshash.h | 1 | ||||
-rw-r--r-- | src/htsparse.c | 4 |
5 files changed, 12 insertions, 15 deletions
diff --git a/src/htscore.c b/src/htscore.c index 08e3902..b7cd1b3 100644 --- a/src/htscore.c +++ b/src/htscore.c @@ -419,6 +419,12 @@ int hts_record_link(httrackp * opt, return success; } +void hts_invalidate_link(httrackp * opt, int lpos) { + /* devalidate entry */ + opt->liens[lpos]->pass2 = -1; +} + + #define HT_INDEX_END do { \ if (!makeindex_done) { \ if (makeindex_fp) { \ @@ -2499,7 +2505,7 @@ void host_ban(httrackp * opt, int ptr, if (strfield2(jump_identification(heap(i)->adr), host)) { // host hts_log_print(opt, LOG_DEBUG, "Cancel: %s%s", heap(i)->adr, heap(i)->fil); - hash_invalidate_entry(opt->hash, i); // invalidate hashtable entry + hts_invalidate_link(opt, i); // invalidate hashtable entry // on efface pas le hash, because si on rencontre le lien, reverif sav.. } } else { diff --git a/src/htscore.h b/src/htscore.h index 774b1d7..8fd709b 100644 --- a/src/htscore.h +++ b/src/htscore.h @@ -345,6 +345,9 @@ int hts_record_link(httrackp * opt, // index of the latest added link size_t hts_record_link_latest(httrackp *opt); +// invalidate an entry +void hts_invalidate_link(httrackp * opt, int lpos); + // wipe all records void hts_record_init(httrackp *opt); void hts_record_free(httrackp *opt); diff --git a/src/htshash.c b/src/htshash.c index 4e0475f..8cc2f1f 100644 --- a/src/htshash.c +++ b/src/htshash.c @@ -319,14 +319,3 @@ void hash_write(hash_struct * hash, size_t lpos) { inthash_write(hash->former_adrfil, (char*) (*hash->liens)[lpos], lpos); } } - -void hash_invalidate_entry(hash_struct * hash, int lpos) { - if (inthash_remove(hash->adrfil, (char*) (*hash->liens)[lpos])) { - /* devalidate entry now it is removed from hashtable */ - strcpybuff((*hash->liens)[lpos]->adr, "!"); - /* add back */ - inthash_write(hash->adrfil, (char*) (*hash->liens)[lpos], lpos); - } else { - assertf(! "error invalidating hash entry"); - } -} diff --git a/src/htshash.h b/src/htshash.h index b6ee417..484eb76 100644 --- a/src/htshash.h +++ b/src/htshash.h @@ -56,7 +56,6 @@ void hash_free(hash_struct *hash); int hash_read(const hash_struct * hash, const char *nom1, const char *nom2, hash_struct_type type); void hash_write(hash_struct * hash, size_t lpos); -void hash_invalidate_entry(hash_struct * hash, int lpos); int *hash_calc_chaine(hash_struct * hash, hash_struct_type type, int pos); unsigned long int hash_cle(const char *nom1, const char *nom2); #endif diff --git a/src/htsparse.c b/src/htsparse.c index 37f0357..084ec8e 100644 --- a/src/htsparse.c +++ b/src/htsparse.c @@ -3507,7 +3507,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str, urladr(), urlfil(), moved->adr, moved->fil); // canceller lien actuel error = 1; - hash_invalidate_entry(hashptr, ptr); // invalidate hashtable entry + hts_invalidate_link(opt, ptr); // invalidate hashtable entry // noter NOUVEAU lien //xxc xxc // set_prio_to=0+1; // protection if the moved URL is an html page!! @@ -3628,7 +3628,7 @@ int hts_mirror_check_moved(htsmoduleStruct * str, // // canceller lien actuel error = 1; - hash_invalidate_entry(hashptr, ptr); // invalidate hashtable entry + hts_invalidate_link(opt, ptr); // invalidate hashtable entry // } else { // oups erreur, plus de mémoire!! XH_uninit; // désallocation mémoire & buffers |