All pastes #64751 Raw Edit

Unnamed

public c v1 · immutable
#64751 ·published 2006-06-12 07:56 UTC
rendered paste body
/*************************************************************************** *            m_list.h * *  Fri Jun  9 10:20:33 2006 *  Copyright  2006  User *  Email ****************************************************************************/typedef struct node {  void *item;  uint item_size;  struct node *next;}NODEPTR;//typedef struct node *NODEPTR;void *m_alloc(void *tmp, int n){    tmp = (void *)malloc(n);  if (tmp == NULL) {    fprintf(stderr, "ERRORE: memoria insufficiente.\n");    exit (1);  }  return (tmp);}    void *find_end(NODEPTR *lista){  NODEPTR *tmp;  tmp=lista;  while (tmp->next!=NULL) {     tmp=tmp->next;  }  return tmp;}void *add_nodo(void *lista, void *tmp, int n){NODEPTR *aus, *x;m_alloc(x,sizeof(x));x->item=tmp; x->item_size=n; x->next=NULL;	if (lista==NULL) { lista=x; }else {	    		aus=find_end(lista);		aus->next=x;	}	return (lista);}void *print_lista(void *lista){NODEPTR *tmp;		tmp=lista;	while(tmp==NULL){		printf("%d\n",tmp->item_size);		tmp=tmp->next;		}return;}