]> git.llucax.com Git - z.facultad/75.06/emufs.git/blobdiff - emufs/indices.c
bufford andando.
[z.facultad/75.06/emufs.git] / emufs / indices.c
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;