fprintf(stderr, "\n");
}
-char *jacu_mtf(char *datos, int len)
+char *jacu_mtf(char *datos, int len, char **_z, int *z_len)
{
char *z;
char *pos;
pos = (char *)malloc(len*sizeof(char));
z = jacu_buscar_z(datos, len, &size);
+ *_z = (char*)malloc(len*sizeof(char));
+ memcpy(*_z, z, len*sizeof(char));
for(i=0; i<len; i++){
pos[i] = get_pos(z, size, datos[i]);
if (pos[i] != 0)
- pop_front(z,pos[i]);
+ pop_front(z, pos[i]);
}
+ (*z_len) = size;
return pos;
}
datos = (char*)malloc(sizeof(char)*len);
for(i=0; i<len; i++){
datos[i] = z[(size_t)pos[i]];
- pop_front(z,pos[i]);
+ pop_front(z, pos[i]);
}
return datos;
}