-
-/*
- * XXX: this function should not allocate memory as it may be called to
- * print an error because we are out of memory.
- */
-void push_error_list(struct errlist ** errors, char * msg){
- struct errlist *err_lst_tmp;
-
- err_lst_tmp = calloc (1, sizeof (struct errlist) );
- if (err_lst_tmp == NULL) {
- fprintf(stderr, "%s: calloc: %s\n", __FUNCTION__, strerror(errno));
- return;
- }
-
- err_lst_tmp->errmsg = strdup(msg);
- if (err_lst_tmp->errmsg == NULL) {
- fprintf(stderr, "%s: strdup: %s\n", __FUNCTION__, strerror(errno));
- free(err_lst_tmp);
- return;
- }
-
- err_lst_tmp->next = *errors;
- *errors = err_lst_tmp;
-}
-
-
-void reverse_error_list(struct errlist **errors){
- struct errlist *result=NULL;
- struct errlist *current= *errors;
- struct errlist *next;
-
- while ( current != NULL ) {
- next = current->next;
- current->next=result;
- result=current;
- current=next;
- }
- *errors=result;
-
-}
-
-
-void free_error_list(struct errlist **errors){
-struct errlist *err_tmp_lst;
-
- err_tmp_lst = *errors;
-
- while (err_tmp_lst != NULL) {
- free(err_tmp_lst->errmsg);
- err_tmp_lst = error_list->next;
- free(*errors);
- *errors = err_tmp_lst;
- }
-
-
-}
-
-