]> git.llucax.com Git - z.facultad/75.06/emufs.git/commitdiff
Cosas rapido que subo antes de que muera la red de la facu.:
authorRicardo Markiewicz <gazer.arg@gmail.com>
Sat, 29 May 2004 01:42:16 +0000 (01:42 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Sat, 29 May 2004 01:42:16 +0000 (01:42 +0000)
emufs/emufs.c
emufs/indices.c

index 3803cf5bcaf4792fd9e79a3c1410bd9a817df425..fc4165d109df8f505a9d35b871d6cdafccb6251b 100644 (file)
@@ -290,7 +290,18 @@ EMUFS *emufs_abrir(const char *filename)
 
 int emufs_destruir(EMUFS *e)
 {
+       INDICE *del, *cur;
+
        if (e == NULL) return 1;
+
+       /* libero indices */
+       cur = e->indices;
+       while (cur) {
+               del = cur;
+               cur = cur->sig;
+               emufs_indice_destruir(e, cur);
+       }
+
        free(e->nombre);
        free(e);
        return 0;
@@ -496,6 +507,10 @@ EMUFS_BLOCK_ID emufs_create_new_block(EMUFS *emu)
        dummy = (char*)malloc(emu->tam_bloque);
        memset(dummy, 0, emu->tam_bloque);
        fwrite(dummy, emu->tam_bloque, 1, fp);
+<<<<<<< .mine
+       fprintf(stderr, "new_block ftell = %ld\n", ftell(fp));
+=======
+>>>>>>> .r552
        switch(emu->tipo){
                case T1: num = (ftell(fp)-sizeof(EMUFS_Tipo)-sizeof(EMUFS_BLOCK_SIZE))/emu->tam_bloque;
                        break;
index c767d6445c471d4a5badcfd955929945a8eb83cb..f7a0ff2f03b7b009cb275d769fcc2457fac04787 100644 (file)
@@ -88,8 +88,12 @@ void emufs_indice_destruir(EMUFS *emu, INDICE *i)
 {
        /* TODO Sacar el indice de la lista en EMUFS */
 
+       if (!i) return;
+
        if (i->tipo == IDX_STRING)
                emufs_destruir(i->emu_string);
+       if (i->funcion != IND_PRIMARIO)
+               emufs_destruir(i->emu_mult);
        free(i->filename);
        free(i->nombre);
        free(i);
@@ -133,10 +137,10 @@ CLAVE emufs_indice_generar_clave_desde_valor(INDICE *idx, char *data)
                        /* Hack feo :-D */
                        sprintf(salvar, "%s", data);
                        k.i_clave = idx->emu_string->grabar_registro(idx->emu_string,
-                                                                               salvar,
-                                                                               strlen(salvar)+1,
-                                                                               &error
-                                                                       );
+                               salvar,
+                               strlen(salvar)+1,
+                               &error
+                       );
        }
 
        return k;
@@ -159,10 +163,10 @@ CLAVE emufs_indice_generar_clave(INDICE *idx, char *data)
                        PERR(idx->nombre);
                        PERR(data+idx->offset);
                        k.i_clave = idx->emu_string->grabar_registro(idx->emu_string,
-                                                                               data+idx->offset,
-                                                                               strlen(data+idx->offset)+1,
-                                                                               &error
-                                                                       );
+                               data+idx->offset,
+                               strlen(data+idx->offset)+1,
+                               &error
+                       );
        }
 
        return k;