#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#include <errno.h>
#include "sn_comparator.h"
#include "sn_stage.h"
sn_comparator_t *temp;
int i;
+ if ((s == NULL) || (c == NULL))
+ return (EINVAL);
+
+ i = sn_stage_comparator_check_conflict (s, c);
+ if (i != 0)
+ return (i);
+
temp = (sn_comparator_t *) realloc (s->comparators,
(s->comparators_num + 1) * sizeof (sn_comparator_t));
if (temp == NULL)
- return (-1);
+ return (ENOMEM);
s->comparators = temp;
temp = NULL;
int nmemb = s->comparators_num - (c_num + 1);
sn_comparator_t *temp;
+ if ((s == NULL) || (s->comparators_num <= c_num))
+ return (EINVAL);
+
assert (c_num < s->comparators_num);
assert (c_num >= 0);
int new_position = input;
int i;
+ if ((s == NULL) || (input < 0))
+ return (-EINVAL);
+
for (i = 0; i < s->comparators_num; i++)
{
sn_comparator_t *c = s->comparators + i;