diff options
Diffstat (limited to 'polynom.c')
-rw-r--r-- | polynom.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -10,6 +10,8 @@ #include "main.h" #include <stdio.h> #include <math.h> +#include <stdlib.h> +#include <string.h> #ifdef HAVE_CONFIG_H #include "config.h" #else @@ -51,7 +53,7 @@ void ply_destruct(polynome poly) polynome ply_copy(polynome poly) { /* recopie */ - polynome result = NULL, temp, t; + polynome result = NULL, temp = NULL, t; while (poly) { t = ply_constr(poly->coef, poly->degre); @@ -72,7 +74,7 @@ polynome ply_copy(polynome poly) polynome ply_addition(polynome poly1, polynome poly2) { /* addition de deux polynomes */ - polynome resultat = NULL, temp, t; + polynome resultat = NULL, temp = NULL, t; rationnel newrat; int degre; @@ -131,7 +133,7 @@ polynome ply_addition(polynome poly1, polynome poly2) polynome ply_soustraction(polynome poly1, polynome poly2) { /* soustraction de deux polynomes */ - polynome resultat = NULL, temp, t; + polynome resultat = NULL, temp = NULL, t; rationnel newrat; int degre; @@ -190,7 +192,7 @@ polynome ply_soustraction(polynome poly1, polynome poly2) polynome ply_multiplication(polynome poly1, polynome poly2) { /* multiplication de deux polynomes */ - polynome temp, t, resultat = NULL; + polynome temp = NULL, t, resultat = NULL; while (poly1) { while (poly2) { @@ -261,8 +263,7 @@ double ply_valuation(polynome poly, double point) char *ply_affichage(polynome poly) { /* routine d'affichage d'un polynome */ - char buf[512], temp[32]; /* FIXME: pas glop comme routine, malloquer tout ca ? */ - char debut = 1; + char buf[BUFSIZ], temp[BUFSIZ]; /* FIXME: pas glop comme routine, malloquer tout ca ? */ while (poly) { if (poly->degre != 0) { @@ -271,6 +272,6 @@ char *ply_affichage(polynome poly) sprintf(temp, "%+f", rat_to_double(poly->coef)); } strcat(buf, temp); /* FIXME: gerer le depassement de buf si po malloc */ - return Estrdup(buf); } + return Estrdup(buf); } |