#include "cmd.h"
#include "list.h"
#include "util.h"
+#include "totais.h"
+#include "calcula.h"
void dependente_free(void *pointer)
{
struct dependente *dependente;
int r = 0;
dependente = malloc(sizeof(*dependente));
- /* TODO: consertar set_int para funcionar como set_llong */
- r += set_int(args, 2, &dependente->codigo);
- dependente->nome = strdup(args[2]);
- dependente->dn = strdup(args[3]);
- dependente->cpf = strdup(args[4]);
- if (!dependente->nome || !dependente->dn || !dependente->cpf) {
- dependente_free(dependente);
- return NULL;
- }
+ r += set_int(args[1], &dependente->codigo);
+ r += set_string(args[2], &dependente->nome);
+ r += set_string(args[3], &dependente->dn);
+ r += set_string(args[4], &dependente->cpf);
if (r < 0 || dependente->codigo < 0) {
dependente_free(dependente);
return NULL;
dependente_free(dependente);
return r;
}
+ r = totais_add(dec, "DEPENDENTES", deducao_dependente(dec));
return 0;
}