Index: pobyso.c
===================================================================
--- pobyso.c	(revision 135)
+++ pobyso.c	(revision 136)
@@ -136,7 +136,7 @@
 {
   int expressionLength, i;
   char *expressionWithSemiCo;
-  sollya_obj_t expressionSa;
+  sollya_obj_t expressionSo;
 
   /* Arguments check. */
   if (expression == NULL)
@@ -166,8 +166,16 @@
     if (expression[i] == ';') /* Nothing special to do:
                                  try to parse the string*/
     {
-      expressionSa = sollya_lib_parse_string(expression);
-      return expressionSa;
+      expressionSo = sollya_lib_parse_string(expression);
+      if (sollya_lib_obj_is_error(expressionSo))
+      {
+        sollya_lib_clear_obj(expressionSo);
+        return NULL;
+      }
+      else
+      {
+        return expressionSo;
+      }
     }
     else
     {
@@ -191,9 +199,17 @@
         strncpy(expressionWithSemiCo, expression, i+1);
         expressionWithSemiCo[i + 1] = ';';
         expressionWithSemiCo[i + 2] = '\0';
-        expressionSa = sollya_lib_parse_string(expressionWithSemiCo);
+        expressionSo = sollya_lib_parse_string(expressionWithSemiCo);
         free(expressionWithSemiCo);
-        return expressionSa;
+        if (sollya_lib_obj_is_error(expressionSo))
+        {
+          sollya_lib_clear_obj(expressionSo);
+          return NULL;
+        }
+        else
+        {
+          return expressionSo;
+        }
       } /* End character != ';' and from a blank. */
     /* Create a new string for the expression, add the ";" and
      * and call sollya_lib_parse_string. */
@@ -206,7 +222,6 @@
                        "ONLY_BLANK_ARGUMENT",
                         "The expression is only made of blanks");
   return NULL;
-
 } /* pobyso_parse_string */
 
 pobyso_func_exp_t
@@ -295,56 +310,58 @@
  * @see pobyso.h#pobyso_subpoly
  */
 pobyso_func_exp_t
-pobyso_subpoly(pobyso_func_exp_t polynomialSo, long expsNum,...)
+pobyso_subpoly(pobyso_func_exp_t polynomialSo, long expsNum, long int* expsList)
 {
-  sollya_obj_t expsListSo = NULL;
-  sollya_obj_t* expsList  = NULL;
-  sollya_obj_t subpoly    = NULL;
+  sollya_obj_t  expsListSo    = NULL;
+  sollya_obj_t* expsList_pso  = NULL;
+  sollya_obj_t subpoly        = NULL;
+  int i, j;
 
-  va_list vaExpsList;
-  int currentExp;
-  int i;
-
   /* Arguments check. */
   if (polynomialSo == NULL) return NULL;
   if (expsNum < 0) return NULL;
   if (expsNum == 0) return sollya_lib_copy_obj(polynomialSo);
-
-  va_start(vaExpsList, expsNum);
-  expsList = (sollya_obj_t*) malloc(expsNum * sizeof(sollya_obj_t));
-  if (expsList == NULL)
+  if (expsList == 0) return NULL;
+  /* Create a list of Sollya constants. */
+  expsList_pso = (sollya_obj_t*) malloc(expsNum * sizeof(sollya_obj_t));
+  if (expsList_pso == NULL)
   {
     pobyso_error_message("pobyso_subpoly",
                           "MEMORY_ALLOCATION_ERROR",
-                          "Could not allocate the expression string");
+                          "Could not allocate the Sollya exponents list");
     return NULL;
   }
+  /* Fill up the list. */
   for (i = 0 ; i < expsNum ; i++)
   {
-    currentExp = va_arg(vaExpsList, long);
-    expsList[i] = sollya_lib_constant_from_int64(currentExp);
+    /* Abort if an exponent is negative. */
+    if (expsList[i] < 0 )
+    {
+      for (j = 0 ; j < i ; j++)
+      {
+        sollya_lib_clear_obj(expsList_pso[j]);
+      }
+      free(expsList_pso);
+      return NULL;
+    }
+    expsList_pso[i] = sollya_lib_constant_from_int64(expsList[i]);
   } /* End for */
-  va_end(vaExpsList);
-  expsListSo = sollya_lib_list(expsList, expsNum);
-  if (expsList == NULL)
+  expsListSo = sollya_lib_list(expsList_pso, expsNum);
+  for (i = 0 ; i < expsNum ; i++)
   {
+    sollya_lib_clear_obj(expsList_pso[i]);
+  }
+  free(expsList_pso);
+  if (expsListSo == NULL)
+  {
     pobyso_error_message("pobyso_subpoly",
                           "LIST_CREATIONERROR",
                           "Could not create the exponents list");
-    for (i = 0 ; i < expsNum ; i++)
-    {
-      sollya_lib_clear_obj(expsList[i]);
-    }
-    free(expsList);
     return NULL;
   }
   subpoly = sollya_lib_subpoly(polynomialSo, expsListSo);
+  pobyso_autoprint(expsListSo);
   sollya_lib_clear_obj(expsListSo);
-  for (i = 0 ; i < expsNum ; i++)
-  {
-    sollya_lib_clear_obj(expsList[i]);
-  }
-  free(expsList);
   return subpoly;
 } /* pobyso_subpoly. */
 
