]> git.llucax.com Git - z.facultad/75.06/emufs.git/blobdiff - emufs/idx.c
* Bugfix en idx_get para saltar los registros no utilizados
[z.facultad/75.06/emufs.git] / emufs / idx.c
index 701ba2597cdf0be3fd123c0dcaec0414045c7a18..8b4f969a922b1c2e3df7e99ad6abdb5a6f266202 100644 (file)
@@ -214,14 +214,18 @@ EMUFS_REG_ID *emufs_idx_get(EMUFS *emu, EMUFS_REG_ID *cant)
        count = 0;
        while (!feof(f_idx)) {
                if (fread(&reg, sizeof(EMUFS_IDX), 1, f_idx) != 1) continue;
        count = 0;
        while (!feof(f_idx)) {
                if (fread(&reg, sizeof(EMUFS_IDX), 1, f_idx) != 1) continue;
-               count++;
                /* TODO : Verificar errores :-D */
                /* TODO : Verificar errores :-D */
-               tmp = realloc(tmp, count);
-               tmp[count-1] = reg.id_reg;
+               if (reg.location != EMUFS_NOT_FOUND) {
+                       count++;
+                       tmp = realloc(tmp, count);
+                       tmp[count-1] = reg.id_reg;
+                       fprintf(stderr, "Nuevo registro de id = %lu\n", reg.id_reg);
+               }
        }
        fclose(f_idx);
 
        (*cant) = count;
        }
        fclose(f_idx);
 
        (*cant) = count;
+       fprintf(stderr, "Mando %d registros\n", count);
        return tmp;
 }
 
        return tmp;
 }