now calculate the number of invalid links in the linktable

This commit is contained in:
Fufu Fang 2019-04-26 18:25:40 +01:00
parent 579454be3d
commit e2c47260a0
1 changed files with 6 additions and 1 deletions

View File

@ -218,7 +218,7 @@ static void LinkTable_fill(LinkTable *linktbl)
static void LinkTable_gap_fill(LinkTable *linktbl)
{
for (int i = 0; i < linktbl->num; i++) {
if (linktbl->links[i]->type == LINK_INVALID) {
if (!linktbl->links[i]->type) {
Link_get_stat(linktbl->links[i]);
}
}
@ -241,6 +241,7 @@ static void LinkTable_free(LinkTable *linktbl)
static void LinkTable_print(LinkTable *linktbl)
{
int i = 0;
fprintf(stderr, "--------------------------------------------\n");
fprintf(stderr, " LinkTable %p for %s\n", linktbl,
linktbl->links[0]->f_url);
@ -254,9 +255,13 @@ static void LinkTable_print(LinkTable *linktbl)
this_link->linkname,
this_link->f_url
);
if (!this_link->type) {
i++;
}
}
fprintf(stderr, "--------------------------------------------\n");
fprintf(stderr, "The number of invalid link: %d.\n", i);
}
LinkTable *LinkTable_new(const char *url)