Suporta carnê leão
[cascardo/declara.git] / lib / declaracao.c
index 39bca5d..2fa6c4a 100644 (file)
@@ -26,6 +26,7 @@
 #include "conjuge.h"
 #include "sistema.h"
 #include "rendimento.h"
+#include "carne.h"
 #include "isento.h"
 #include "pagamento.h"
 #include "bem.h"
@@ -48,6 +49,9 @@ struct declaracao * declaracao_new(int ano)
        dec->rendimento = list_new();
        if (!dec->rendimento)
                goto out_rendimento;
+       dec->carne = list_new();
+       if (!dec->carne)
+               goto out_carne;
        dec->isentos = list_new();
        if (!dec->isentos)
                goto out_isentos;
@@ -78,6 +82,8 @@ out_bens:
 out_pagamentos:
        list_free(dec->isentos, isento_free);
 out_isentos:
+       list_free(dec->carne, carne_free);
+out_carne:
        list_free(dec->rendimento, rendimento_free);
 out_rendimento:
        free(dec);
@@ -103,6 +109,7 @@ void declaracao_free(struct declaracao *dec)
        if (dec->dvconta)
                free(dec->dvconta);
        list_free(dec->rendimento, rendimento_free);
+       list_free(dec->carne, carne_free);
        list_free(dec->isentos, isento_free);
        list_free(dec->pagamentos, pagamento_free);
        list_free(dec->bens, bem_free);
@@ -132,6 +139,7 @@ void dec_cmd_init(void)
        contribuinte_cmd_init();
        conjuge_cmd_init();
        rendimento_cmd_init();
+       carne_cmd_init();
        isento_cmd_init();
        pagamento_cmd_init();
        bem_cmd_init();